cardinaluk
New Member
- Joined
- Apr 8, 2013
- Messages
- 7
Hi,
I have recently discovered this wonderful code snippet:
Of course it transfers rows of data from one location to another, catering for any blank rows.
For my complete understanding can someone talk me through it, specifically this bit:
Range("A1:G" & [A65536].End(xlUp).Row) - what I really don't understand is the inclusion of an & instead of a comma. Is this just the syntax when you are using square brackets?
I would also like to understand in the last line src.Copy destination:=dest, what does the := mean?
I also need to know why you need to set the destination using a similar bit of code? I would have thought the set source would be enough?
Regards,
C
I have recently discovered this wonderful code snippet:
Of course it transfers rows of data from one location to another, catering for any blank rows.
Code:
Sub TransferData()
Dim src As Range, dest As Range
Set src = ActiveSheet.Range("A1:G" & [A65536].End(xlUp).Row)
Set dest = Worksheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
src.Copy Destination:=dest
End Sub
For my complete understanding can someone talk me through it, specifically this bit:
Range("A1:G" & [A65536].End(xlUp).Row) - what I really don't understand is the inclusion of an & instead of a comma. Is this just the syntax when you are using square brackets?
I would also like to understand in the last line src.Copy destination:=dest, what does the := mean?
I also need to know why you need to set the destination using a similar bit of code? I would have thought the set source would be enough?
Regards,
C