![]() |
PasteSpecial and Offset
greetings
Here is some code from XL help. With Worksheets("Sheet1") .Range("C1:C5").Copy .Range("D1:D5").PasteSpecial _ Operation:=xlPasteSpecialOperationAdd End With My code is similar, but I want the PasteSpecial to be offset by 7*CatNum columns to the right. CatNum is defined earlier in my code as Integer. If CatNum = 0, then the code should run as shown. If CatNum = 3, then the PasteSpecial should be offset by 21 columns. I'm having trouble with the offset syntax. Much thanks Giselle |
PasteSpecial and Offset
Dim rng as Range
With Worksheets("Sheet1") set rng = .Range("C1:C5") rng.Copy rng.offset(0,catnum*7).Pastespecial _ Operation:=xlPasteSpecialOperationAdd End With -- Regards, Tom Ogilvy "Giselle" wrote: greetings Here is some code from XL help. With Worksheets("Sheet1") .Range("C1:C5").Copy .Range("D1:D5").PasteSpecial _ Operation:=xlPasteSpecialOperationAdd End With My code is similar, but I want the PasteSpecial to be offset by 7*CatNum columns to the right. CatNum is defined earlier in my code as Integer. If CatNum = 0, then the code should run as shown. If CatNum = 3, then the PasteSpecial should be offset by 21 columns. I'm having trouble with the offset syntax. Much thanks Giselle |
All times are GMT +1. The time now is 11:03 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com