Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Trying to use cells as a variable to calculate(count) an array

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   Report Post  
Posted to microsoft.public.excel.programming
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)?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Trying to use cells as a variable to calculate(count) an array

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Trying to use cells as a variable to calculate(count) an array

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Trying to use cells as a variable to calculate(count) an array

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Trying to use cells as a variable to calculate(count) an array

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i count text cells in excel based on variable criteria? anmaka57 Excel Worksheet Functions 2 January 26th 10 04:00 PM
Complex conditional summing - array COUNT works, array SUM gives#VALUE fatcatfan Excel Worksheet Functions 4 November 18th 09 06:41 PM
Concatenate Variable Array of Text Cells atryon Excel Discussion (Misc queries) 3 August 29th 08 11:57 PM
Count if array contains cells of a certain value Melissa Excel Worksheet Functions 2 July 29th 05 02:37 AM
Problem trying to us a range variable as an array variable TBA[_2_] Excel Programming 4 September 27th 03 02:56 PM


All times are GMT +1. The time now is 04:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"