View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
MikeC[_4_] MikeC[_4_] is offline
external usenet poster
 
Posts: 1
Default Set a range in a Macro to copy

Hi,

I need copy a cell into a range of cells in another column, where the
range is determined by the height of another column (row value of the
last non-blank character)

The following code copies the contents of cell D1 into the range
"E1","E42"). When I try to replace 42 with the value of the Match
function it does not work.

Range("D1").Select
Selection.Copy
' Match("",B:B,1) evaluates to 42 in the spread sheet, the last
non-blank row in Column B
' When used in to select the range I get a compile error.
' How do I fix this?????????
'
' Range("E1", "H" & Match("",B:B,1)).Select
'
Range("E1", "E" & 42).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

Thanks,

MikeC