Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Using variables to define a range of cells?

Is there a way to refer to a range of cells completely by variables:
Range((A,B), (C,D))
where A, B, C and D are integer variables

any help would be appreciated
thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Using variables to define a range of cells?

Matt,

The following code will select B1:D3

Dim A As Integer: A = 1
Dim B As Integer: B = 2
Dim C As Integer: C = 3
Dim D As Integer: D = 4

Range(Cells(A, B), Cells(C, D)).Select


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Matt" wrote in message
oups.com...
Is there a way to refer to a range of cells completely by
variables:
Range((A,B), (C,D))
where A, B, C and D are integer variables

any help would be appreciated
thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Using variables to define a range of cells?

Thanks, exactly what I was looking for (should have guessed it would be
as simple as putting Cells in, must be a long day for me already)

Reply
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
How do I define a range using values in cells? Matthieu de Wit Excel Worksheet Functions 2 April 26th 06 09:43 PM
How to define a range based on first and last cells with data? Dennis Excel Programming 5 March 1st 06 01:45 PM
Define a range of cells in VBA Noemi Excel Discussion (Misc queries) 2 October 20th 05 04:32 AM
How to use variables to define range Dolemite Excel Programming 4 August 12th 05 06:12 PM
Re-define a range in cells Geoff Excel Programming 0 June 1st 05 01:00 AM


All times are GMT +1. The time now is 10:04 AM.

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"