Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using a variable to select a row index in excel.

Posted on 2001-09-07
2
Medium Priority
?
266 Views
Last Modified: 2012-06-21
I'm sure this is unbelievably simple, but can anyone tell me how to use a variable to select a row in an excel macro.

e.g If I want to select rows 2 and 3 then I would write

Rows("2:3").Select

What I want is to be able to replace the 2 and 3 with a and b (where a is 2 and b is 3).

Thanks

Stuart
0
Comment
Question by:StuartL
2 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 200 total points
ID: 6463438
Dim a As String
Dim b As String
a = "2"
b = "3"
Rows(a & ":" & b).Select
0
 

Author Comment

by:StuartL
ID: 6463468
That works great, thanks.  I just couldn't find out the format of the (a&.. bit.

Cheers

Stuart
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question