Using variables in cell references

pduffer
03-27-2003, 12:40 PM
I am writing a macro that will add blank rows to a spreadsheet, and then transpose a range of data from one row to one column. However, the number of rows to add and columns of data to transpose will vary from 10 to 200. I want to have a prompt that will then be used to tell how many blank rows to enter and how many columns to in one row to copy, then transpose. I have figured out how to prompt for the numbers, but don't know how to enter the result in a reference.

For example: Range("A1:A9")
If I ask for a user input to Questions, how would I substitue the value of Questions in place of the 9 in A9 above?

Thanks.

Wamphyri
03-27-2003, 12:53 PM
Range using the Cells format is one way
Range(Cells(1,1),Cells(YourVariable,1))

or string concatenation is another
Range("A1:A" & YourVariable)

pduffer
03-27-2003, 12:59 PM
[Thanks for the reply. Seems to be just what I was looking for!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum