R
rockhammer
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,D1334,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.
non-continguous blocks of cells to copy/paste, I get code like this:
Range("B13:B34,D1334,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.