Jul 28 2022 01:42 AM
Hi, I have created a last row variable in VBA and want to use them in range to copy a range of SPECIFIC COLUMN (e.g. B1 to last row and E to last row) but couldn't get it to work (See code in red). The code works if I replace last row with integer...
Kindly assist.
Jul 28 2022 02:01 AM
Your use of double quote "" is wrong. Try below line-
Set table=Worksheets("Database").Range("B1:B" & lastrow, "E1:E" & lastrow)
Jul 28 2022 02:10 AM
@peysg No VBA expert here, but why not just:
Set Table = Worksheets("Database").Range("B1:E" & lastrow)
?
Jul 28 2022 02:15 AM - edited Jul 28 2022 02:16 AM
This doesnt work, it still copy columns from B to E, i want to skip column C & D
Jul 28 2022 02:57 AM
Set table = Worksheets("Database").Range("B1:B" & lastrow & ",E1:E" & lastrow)
Jul 28 2022 03:01 AM