LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
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

 
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
Syntax for selecting a textbox within a chart? tenlbham Charts and Charting in Excel 4 April 25th 07 02:39 AM
Selecting a range of values on pivot table attribute with a macro Ryan Hartnett Excel Discussion (Misc queries) 1 October 24th 06 10:21 PM
Range used in a macro needs to be variable DaveP Excel Worksheet Functions 3 November 4th 05 03:23 PM
variable range in a macro AMK Excel Discussion (Misc queries) 3 July 6th 05 09:32 AM
Is it possible to set a variable range in a macro? Mary About this forum 0 June 12th 05 06:26 PM


All times are GMT +1. The time now is 08:16 PM.

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"