Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Compare Cell Values, Offset(-1,0), Offset(-1,-1), and xlFillDefaul | Excel Worksheet Functions | |||
PasteSpecial | Excel Programming | |||
PasteSpecial | Excel Programming | |||
pastespecial in vba | Excel Programming | |||
pastespecial | Excel Programming |