ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Make Variable Cell that is Blank? (https://www.excelbanter.com/excel-programming/338464-make-variable-cell-blank.html)

[email protected]

Make Variable Cell that is Blank?
 
I have a Loop that goes through a set of data in range A1:B20. It's a
"Do While" loop that loops while the cells in column A have a specific
value. Cell B1 is always Blank and I want to assign this variable the
cells address. Example: Var x = ("B1"). Then at the end of the loop
I want the active cell to be the cell reference in Var x. Any idea how
to achieve this???

Thanks,
Chris


Chip Pearson

Make Variable Cell that is Blank?
 
Chris,

I'm not exactly sure what you're after, but try something like

Dim Rng As Range
Set Rng = Range("B1")


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



wrote in message
oups.com...
I have a Loop that goes through a set of data in range A1:B20.
It's a
"Do While" loop that loops while the cells in column A have a
specific
value. Cell B1 is always Blank and I want to assign this
variable the
cells address. Example: Var x = ("B1"). Then at the end of
the loop
I want the active cell to be the cell reference in Var x. Any
idea how
to achieve this???

Thanks,
Chris




[email protected]

Make Variable Cell that is Blank?
 
Chip-

Yeah...I wasn't that clear. The Active cell ("B1" above) is dynamic.
It isn't always B1. How do I set the variable to the cell that is
blank and hold that value?

Something like...

Dim Rng As Range
Set Rng = ActiveCell.Address

?????

Thanks,
Chris


Chip Pearson

Make Variable Cell that is Blank?
 
Try

Dim Rng As Range
Set Rng = ActiveCell


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




wrote in message
oups.com...
Chip-

Yeah...I wasn't that clear. The Active cell ("B1" above) is
dynamic.
It isn't always B1. How do I set the variable to the cell that
is
blank and hold that value?

Something like...

Dim Rng As Range
Set Rng = ActiveCell.Address

?????

Thanks,
Chris




Tom Ogilvy

Make Variable Cell that is Blank?
 
dim rng as range
' looping structure
if isempty(ActiveCell) then
set rng = ActiveCell
End if

' loop ends


rng.Activate

--- or -----

Dim x as String
x = ActiveCell.Address

' time passes

Range(x).Activate

--
Regards,
Tom Ogilvy

wrote in message
oups.com...
Chip-

Yeah...I wasn't that clear. The Active cell ("B1" above) is dynamic.
It isn't always B1. How do I set the variable to the cell that is
blank and hold that value?

Something like...

Dim Rng As Range
Set Rng = ActiveCell.Address

?????

Thanks,
Chris




[email protected]

Make Variable Cell that is Blank?
 
Chip-

THANK YOU! Works like a charm.

I appreciate it.

-Chris



All times are GMT +1. The time now is 11:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com