Archive of Mr Excel Message Board
Back to Excel VBA archive index
Back to archive home
Select rows using variablesPosted by Darin Wilmert on October 14, 2001 10:06 AM
Hi, I have a need in a macro to select a bunch of rows.
I know you can do something like thi:
but I want to use variables instead, like this:
However, I can't get this to work. Is there any way
to accomplish this? I've tried every permeutation I can
think of, with or without quotes, everything. It won't
accept it with variables. Thanks.
|Check out our Excel VBA Resources
Re: Select rows using variablesPosted by Shawn on October 14, 2001 1:24 PM
var1 = 1
var2 = 5
Rows(var1 & ":" & var2).Select
That worked for me, looks like you just have to keep the varibles outside the quotes and add the and statement (&)
This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store
to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.