Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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)? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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)? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Toppers, this is a big help. Now how do I convert a range value to an
integer value so that I could actually use it in an array type formula? Brett "Toppers" wrote: 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)? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Brett,
Sorry to be so dumb but I am not sure what you mean by converting a range value to an integer value. Can you give an example of what you need (array formula) ? "Brett Smith" wrote: Thanks Toppers, this is a big help. Now how do I convert a range value to an integer value so that I could actually use it in an array type formula? Brett "Toppers" wrote: 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)? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nevermind, I figured it out. It is Int("value") which converts a range to an
int value. Thanks! Brett "Brett Smith" wrote: Thanks Toppers, this is a big help. Now how do I convert a range value to an integer value so that I could actually use it in an array type formula? Brett "Toppers" wrote: 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)? |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In your scenario, first is always 1, last would be
rng.count -- HTH RP (remove nothere from the email address if mailing direct) "Brett Smith" wrote in message ... Thanks Toppers, this is a big help. Now how do I convert a range value to an integer value so that I could actually use it in an array type formula? Brett "Toppers" wrote: 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)? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how do i count text cells in excel based on variable criteria? | Excel Worksheet Functions | |||
Complex conditional summing - array COUNT works, array SUM gives#VALUE | Excel Worksheet Functions | |||
Concatenate Variable Array of Text Cells | Excel Discussion (Misc queries) | |||
Count if array contains cells of a certain value | Excel Worksheet Functions | |||
Problem trying to us a range variable as an array variable | Excel Programming |