LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default selecting non-contiguous blocks of cells in vb

When I use the record macro from the drop down menu to select multiple
non-continguous blocks of cells to copy/paste, I get code like this:

Range("B13:B34,D13:D34,I13:I34").Select
Range("I13").Activate
Selection.Copy
Range("S13").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

I tried to duplicate the above in vb using this:

Dim fmcv As Worksheet
Dim topbot As Worksheet
' every other variable below undefined explicitly were defined as Long

fmcv.Activate
Range(Range(Cells(fmcvRowStart, fmcvSecidCol), Cells(fmcvRowEnd,
fmcvSecidCol)), _
Range(Cells(fmcvRowStart, fmcvIssuerCol), Cells(fmcvRowEnd,
fmcvIssuerCol)), _
Range(Cells(fmcvRowStart, fmcvPctPortfolioCol), Cells(fmcvRowEnd,
fmcvPctPortfolioCol))).Select
Selection.Copy
topbot.Activate
Cells(topbot1stRow, topbotTickerCol).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False

But the above is givng me a "compile error: wrong # of arguments or invalid
property assignment" at the first instance of the word 'range'.

Question: is it actually possible to accomplish what I want and, if so, how?

Thanks a lot.

 
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
automatically selecting contiguous cells - Why? becder New Users to Excel 5 March 16th 10 05:59 PM
selecting non-contiguous cells facinadr Excel Discussion (Misc queries) 1 February 1st 10 10:09 PM
Stop selecting blocks of cells Legallisa - switching from WordPerfect New Users to Excel 2 June 10th 08 03:04 AM
Selecting a contiguous row of cells [email protected] Excel Discussion (Misc queries) 1 March 23rd 07 08:06 PM
Printing non contiguous blocks thunder52 Excel Programming 2 June 30th 04 01:03 AM


All times are GMT +1. The time now is 01:22 AM.

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

About Us

"It's about Microsoft Excel"