Simple Row Offset Question
I'm using this simple code to copy and paste values from one sheet to
another but for some reason I can't figure out how to move the DestRange1 down one row. I'm pretty sure it's Offset but I can't figure out where to put it... LC1 = Lastcol(WB2.Sheets(2)) + 1 Set SourceRange = WB1.Columns("A:D").Columns("F:K") Set DestRange1 = WB2.Sheets(2).Columns(LC1) SourceRange.Copy DestRange1 Thanks, -- Dan |
Simple Row Offset Question
since you are copying a whole column, you can't move the destination range
down one row. as an example, columns(1).Offset(1,0) won't work -- Regards, Tom Ogilvy "Dan R." wrote: I'm using this simple code to copy and paste values from one sheet to another but for some reason I can't figure out how to move the DestRange1 down one row. I'm pretty sure it's Offset but I can't figure out where to put it... LC1 = Lastcol(WB2.Sheets(2)) + 1 Set SourceRange = WB1.Columns("A:D").Columns("F:K") Set DestRange1 = WB2.Sheets(2).Columns(LC1) SourceRange.Copy DestRange1 Thanks, -- Dan |
Simple Row Offset Question
On Jan 30, 3:17 pm, Tom Ogilvy
wrote: since you are copying a whole column, you can't move the destination range down one row. as an example, columns(1).Offset(1,0) won't work -- Regards, Tom Ogilvy "Dan R." wrote: I'm using this simple code to copy and paste values from one sheet to another but for some reason I can't figure out how to move the DestRange1 down one row. I'm pretty sure it's Offset but I can't figure out where to put it... LC1 = Lastcol(WB2.Sheets(2)) + 1 Set SourceRange = WB1.Columns("A:D").Columns("F:K") Set DestRange1 = WB2.Sheets(2).Columns(LC1) SourceRange.Copy DestRange1 Thanks, -- Dan- Hide quoted text - - Show quoted text - Tom, I just realized that this also isnt the correct way to copy multiple ranges, if I wanted to copy and paste ranges "A:D" and "F:K" what would be the proper way to do this? |
Simple Row Offset Question
On Jan 30, 3:33 pm, "Dan R." wrote:
On Jan 30, 3:17 pm, Tom Ogilvy wrote: since you are copying a whole column, you can't move the destination range down one row. as an example, columns(1).Offset(1,0) won't work -- Regards, Tom Ogilvy "Dan R." wrote: I'm using this simple code to copy and paste values from one sheet to another but for some reason I can't figure out how to move the DestRange1 down one row. I'm pretty sure it's Offset but I can't figure out where to put it... LC1 = Lastcol(WB2.Sheets(2)) + 1 Set SourceRange = WB1.Columns("A:D").Columns("F:K") Set DestRange1 = WB2.Sheets(2).Columns(LC1) SourceRange.Copy DestRange1 Thanks, -- Dan- Hide quoted text - - Show quoted text - Tom, I just realized that this also isnt the correct way to copy multiple ranges, if I wanted to copy and paste ranges "A:D" and "F:K" what would be the proper way to do this?- Hide quoted text - - Show quoted text - Nevermind Tom, it's easier just to delete column E after I paste it. Thanks, -- Dan |
Simple Row Offset Question
Just for completeness:
Range("A:D,F:K").copy -- Regards, Tom Ogilvy "Dan R." wrote in message ups.com... On Jan 30, 3:33 pm, "Dan R." wrote: On Jan 30, 3:17 pm, Tom Ogilvy wrote: since you are copying a whole column, you can't move the destination range down one row. as an example, columns(1).Offset(1,0) won't work -- Regards, Tom Ogilvy "Dan R." wrote: I'm using this simple code to copy and paste values from one sheet to another but for some reason I can't figure out how to move the DestRange1 down one row. I'm pretty sure it's Offset but I can't figure out where to put it... LC1 = Lastcol(WB2.Sheets(2)) + 1 Set SourceRange = WB1.Columns("A:D").Columns("F:K") Set DestRange1 = WB2.Sheets(2).Columns(LC1) SourceRange.Copy DestRange1 Thanks, -- Dan- Hide quoted text - - Show quoted text - Tom, I just realized that this also isnt the correct way to copy multiple ranges, if I wanted to copy and paste ranges "A:D" and "F:K" what would be the proper way to do this?- Hide quoted text - - Show quoted text - Nevermind Tom, it's easier just to delete column E after I paste it. Thanks, -- Dan |
All times are GMT +1. The time now is 04:42 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com