![]() |
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 |
macro syntax for selecting variable range
Sub SelectCells()
Dim X, Y As Integer X = 3 Y = 4 Range("A" & X & ":A" & Y).Select End Sub Gord Dibben MS Excel MVP On Wed, 31 Oct 2007 11:42:13 -0700, Matt wrote: 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 |
All times are GMT +1. The time now is 05:21 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com