View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Toppers Toppers is offline
external usenet poster
 
Posts: 4,339
Default Trying to use cells as a variable to calculate(count) an array

Brett,
Something like this? It will select ROWS from Firstrow to
Lastrow

Sub GetRows()

Dim FirstCell As Range, LastCell As Range
Dim Firstrow As Long, Lastrow As Long

Do
Set FirstCell = Application.InputBox("Enter top left cell - ONE cell
only", Type:=8)
Loop Until FirstCell.Count = 1
Firstrow = FirstCell.Row

Do
Set LastCell = Application.InputBox("Enter bottom right cell - ONE cell
only", Type:=8)
Loop Until LastCell.Count = 1
Lastrow = LastCell.Row

MsgBox Firstrow & " " & Lastrow

Range(Firstrow & ":" & Lastrow).Select

End Sub


HTH

"Brett Smith" wrote:

I am trying to program a dialog box to ask for the first cell which would be
the upper most left cell. Then I am going to try to get a second reading
from a dialog box which a user would enter the lowest most right cell.
Afterwards I want to be able to calculate in my code how many times the
program would go through each line. Afterwards it would spit out a text file
of information taken from the excel file. I know it's easy to say if a
person from 1-1000, but how would I do this if a person selects from Cell A1
- Cell H1000? How would I be able to have my program read the cell number 1
and cell number 1000 without the A and the H? SO I guess I am asking how
would I have it select Range(1:1000) instead of Range(A1:H1000)?