Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compare Cell Values, Offset(-1,0), Offset(-1,-1), and xlFillDefaul RyGuy Excel Worksheet Functions 2 September 28th 07 10:54 PM
PasteSpecial John Austin[_6_] Excel Programming 1 December 14th 05 03:32 PM
PasteSpecial KL[_3_] Excel Programming 1 July 8th 04 02:07 PM
pastespecial in vba cornishbloke[_13_] Excel Programming 7 December 31st 03 01:02 PM
pastespecial billQ Excel Programming 2 July 29th 03 11:39 PM


All times are GMT +1. The time now is 03:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"