Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Variables in Excel
Hi,
I'm having a hard time figuring out how to set a variable in a macro equal to the value in a cell. I then want to be able to use that value with the select method to select a number of rows equal to the value of my variable. The big problem for me is going from the spreadsheet to the macro with a value. Any help appreciated. Thanks, Lang |
#2
|
|||
|
|||
Variables in Excel
will this work?
Sub selectrows() Rows("1:" & Range("b10")).Select End Sub -- Don Guillett SalesAid Software "Lang" wrote in message ... Hi, I'm having a hard time figuring out how to set a variable in a macro equal to the value in a cell. I then want to be able to use that value with the select method to select a number of rows equal to the value of my variable. The big problem for me is going from the spreadsheet to the macro with a value. Any help appreciated. Thanks, Lang |
#3
|
|||
|
|||
Variables in Excel
thanks for the reply Don! I didn't get a chance to check this today, but
will try soon. Lang "Don Guillett" wrote: will this work? Sub selectrows() Rows("1:" & Range("b10")).Select End Sub -- Don Guillett SalesAid Software "Lang" wrote in message ... Hi, I'm having a hard time figuring out how to set a variable in a macro equal to the value in a cell. I then want to be able to use that value with the select method to select a number of rows equal to the value of my variable. The big problem for me is going from the spreadsheet to the macro with a value. Any help appreciated. Thanks, Lang |
#4
|
|||
|
|||
Variables in Excel
to use the value of a range (cell) in a macro, use the syntax: Code: -------------------- myvalue = range("a1").value -------------------- where "a1" is value of interest. then, to select a row use Code: -------------------- rows(myvalue).select -------------------- to select that row number, or Code: -------------------- Rows(startrow & ":" & startrow+myvalue).select -------------------- to select that number of rows -- i-Zapp ------------------------------------------------------------------------ i-Zapp's Profile: http://www.excelforum.com/member.php...fo&userid=5768 View this thread: http://www.excelforum.com/showthread...hreadid=478768 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Urgent Help Required on Excel Macro Problem | Excel Discussion (Misc queries) | |||
Display form from an VB application in Excel | Excel Discussion (Misc queries) | |||
How do you define variables in excel? | Excel Discussion (Misc queries) | |||
Hints And Tips For New Posters In The Excel Newsgroups | Excel Worksheet Functions | |||
Excel 2002 and 2000 co-install. Control Which Starts ? | Excel Discussion (Misc queries) |