Public variable declaration

  • Thread starter Thread starter Alberto Ast
  • Start date Start date
A

Alberto Ast

I tried first searching on the discussion group already place questions but
could not find what I need.

I have a variable I use to store a cell address

xlast = ActiveCell.Address

I am trying to declare it as public so I can use it in other modules but I
have fail several ways... what I have is

Global xlast As Range

Is the Range type correct? or how should I do?
 
ActiveCell.Address is a string.
So:
Public xlast As String

If you used:
Set xlast = ActiveCell
Then
Public xlast As Range would be correct
 
Thanks it works...

Have another question related for future reference...

If I use string then I can use
xlast = activecell.address
range ("A1",xlast).select

but if I use range
I need to do
set xlast = Activecell

How do I get into this cell in the future?
range("A1",xlaset).select will not work
 
Hi

DIm xLast as string
xlast = activecell.address
range ("A1",Range(xlast)).select

Or

Dim xLast as Range
set xlast =activecell
range("A1", xlast).seleect


Regards,
Per
 
DIm xLast as string
xlast = activecell.address
range ("A1",Range(xlast)).select

Or

Dim xLast as Range
set xlast =activecell
range("A1", xlast).select

You can use same last line...

Range("A1", xlast).Select

for both of these approaches.
 
Back
Top