View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Matt Matt is offline
external usenet poster
 
Posts: 60
Default macro syntax for selecting variable range

In a VBA script

Sub SelectCells()
X=3
Range("A1:A" & X).Select
EndSub

would do the same as

Sub SelectCells()
Range("A1:A3").Select
EndSub


I'm wondering is it possible to do something like this?

Sub SelectCells()
X=3
Y=4
'??? Range("A"&X":A" & Y).Select???
EndSub

so that it gives the same as

Sub SelectCells()
X=3
Y=4
'Range("A3:A4").Select
EndSub

Matt