Hi,
I need to copy a full table (called current) to another existing table (called previous) using VBA programming.
the content of the previous should be totally replaced by the new content from the current table.
Someone has a lead here?
Thanks.
Gorov
It would be best if you uploaded a sample workbook so that a more precise answer could be given.
However, here is a basic approach using two options (the last two lines of code before "end sub" are method #2 and are commented out). There are other ways as well, but given the lack of deatails and no example workbook this is the best we can do.
Option Explicit Sub Copy_Table() Dim lrow As Long lrow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Row 'Clear the old table of values - may need to resize the range Sheet2.Range("A1").CurrentRegion.ClearContents Sheet1.Range("a1").CurrentRegion.Copy Destination:=Sheet2.Range("A1") 'Or 'Sheet2.Range("A1:D100").ClearContents 'Sheet1.Range("A1:D" & lrow).Copy Destination:=Sheet2.Range("A1") End Sub
Palmetto
Do you know . . . ?
You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks