Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Pass a variable into a range?

I'm trying to produce a graph in Excel using macros, my problem is that
the amount of data is not always the same (there could be 4 rows or 24
lines), is there any way to pass a variable into a range say for
("A1:M6") = ("A1:M"variable")? I have tried using named ranges but that
just gives me the same issue. Thanks for any help.

Ian B. Fleming
MS Excel and VBA

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 227
Default Pass a variable into a range?

Hi Ian

If your range should include those cells in Column A from A1 to the last
cell in the column and then extend across to Column M, try,,,

Sub test()
Dim r As Range
With ActiveSheet
Set r = .Range(.Range("A1"), .Range("A" & Rows.Count).End(xlUp).Offset(0,
12))
End With
End Sub



--


XL2003
Regards

William



"Ian Fleming" wrote in message
...
I'm trying to produce a graph in Excel using macros, my problem is that
the amount of data is not always the same (there could be 4 rows or 24
lines), is there any way to pass a variable into a range say for
("A1:M6") = ("A1:M"variable")? I have tried using named ranges but that
just gives me the same issue. Thanks for any help.

Ian B. Fleming
MS Excel and VBA

*** Sent via Developersdex
http://www.developersdex.com ***


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
pass variable from one workbook to another calebjill Excel Discussion (Misc queries) 2 January 28th 09 07:38 PM
How to pass a variable into an SQL statement CLamar Excel Discussion (Misc queries) 0 June 5th 06 02:17 PM
How to (re)set a range.value to pass -0- to a "double" variable Dennis Excel Discussion (Misc queries) 2 April 15th 05 11:13 AM
Using Public to Pass Variable D.Parker Excel Programming 8 March 24th 05 10:39 PM
How to pass variable value between macros BCS Excel Programming 0 July 25th 03 08:01 PM


All times are GMT +1. The time now is 12:27 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"