View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default 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