Page 2 of 2 FirstFirst 1 2
Results 11 to 12 of 12

Thread: Two Column Dates to arrange in a single column

  1. #11
    Super Moderator NBVC's Avatar
    Join Date
    May 2011
    Location
    Mississauga, Canada
    Posts
    1,518
    Articles
    0
    Excel Version
    Excel 2016


    Register for a FREE account, and/
    or Log in to avoid these ads!

    See attached.

    I replaced the code with this (it essentially clears and overwrites the data each time you press Merge button).

    Code:
    Public Sub MergeData()
    Dim lastrow As Long
    
    Application.ScreenUpdating = False
    
        With Worksheets("Sheet3")
            .Range("A:B").Clear
        
            Worksheets("Sheet1").UsedRange.Copy .Range("A1")
            
            lastrow = .Range("A1").End(xlDown).Row
             Worksheets("Sheet2").UsedRange.Copy .Cells(lastrow + 1, "A")
             .Rows(lastrow + 1).Delete
             
            lastrow = .Range("A1").End(xlDown).Row
            .Range("A1:B1").Resize(lastrow).Sort Key1:=.Range("A1"), Order1:=xlAscending, Header:=xlYes
        End With
        
        Application.ScreenUpdating = True
    
    End Sub
    and added this code to clear (click the Clear button).

    Code:
    Public Sub ClearData()
    
        With Worksheets("Sheet3")
            .Range("A:B").Clear
        End With
    End Sub
    Attached Files Attached Files


  2. #12
    What i got is what i thought
    Thank you so much.... NBVC
    Also, i thank
    Bob Phillips,Herbds7,lochan79
    for their contributions as well

Page 2 of 2 FirstFirst 1 2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •