Range Referencing Problem


Posted by JohnLat on December 22, 2000 11:50 AM

It was Fredrick Douglass who said:
- If there is no struggle there is no progress.

In this spirit I continue to struggle to understand ranges.
Here is my problem:

I am attempting to select a range in this manner:
Select top of range:
Alpha = ActiveCell.Address
Select bottom of range ( after a new cell is selected ):
Omega = ActiveCell.Address

Then I attempt to select this range:
Range(Alpha, Omega).Select
This gives me the following error message:
Application-defined or object-defined error

Is this simply a syntax error error on the select statement?
Or, is there a more fundamental problem?


Posted by cpod on December 22, 2000 4:30 PM


You can't have more than one active cell. Try this:

Dim Alpha As String
Dim Omega As Range
Alpha = ActiveCell.Address
Set Omega = Application.InputBox(prompt:="Select a cell", Type:=8)
Range(Alpha, Omega.Address).Select


Posted by Celia on December 22, 2000 5:20 PM


I don't see any reason why it shouldn't work.
The following works :-

Dim Alpha As string
Dim Omega As String
Range("A1").Select
Alpha = ActiveCell.Address
Range("A2").Select
Omega = ActiveCell.Address
Range(Alpha, Omega).Select



Posted by JohnLat on December 23, 2000 8:25 AM

Celia, thanks for your help.
For the record the problem turned out to be that I
was setting the variables Alpha & Omega in two different
procedures, BUT I DID NOT DECLARE THEM AS MODULEWIDE
VARIABLES.

I failed to mention that in my original post.

I am still grateful for your help. Your assurance that it
should have worked, gave me the confidence to look
for other factors.