Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 181
Default Public variable declaration

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Public variable declaration

ActiveCell.Address is a string.
So:
Public xlast As String

If you used:
Set xlast = ActiveCell
Then
Public xlast As Range would be correct
"Alberto Ast" wrote in message
...
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?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 181
Default Public variable declaration

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
"JLGWhiz" wrote:

ActiveCell.Address is a string.
So:
Public xlast As String

If you used:
Set xlast = ActiveCell
Then
Public xlast As Range would be correct
"Alberto Ast" wrote in message
...
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?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Public variable declaration

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

On 19 Sep., 03:54, Alberto Ast
wrote:
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



"JLGWhiz" wrote:
ActiveCell.Address is a string.
So:
Public xlast As String


If you used:
Set xlast = ActiveCell
Then
Public xlast As Range would be correct
"Alberto Ast" wrote in message
...
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?- Skjul tekst i anførselstegn -


- Vis tekst i anførselstegn -


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Public variable declaration

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.

--
Rick (MVP - Excel)


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
public variable declaration, memory efficient? slarbie Excel Programming 2 April 6th 09 03:56 PM
Use of Public for data declaration in Excel 2000 Gandalph Excel Programming 1 April 17th 08 06:47 PM
Declaration of public variable - Question Les Stout[_2_] Excel Programming 2 October 5th 05 02:53 PM
Public declaration Greg[_16_] Excel Programming 2 January 21st 05 10:53 PM
public declaration kevin Excel Programming 1 December 6th 03 07:00 PM


All times are GMT +1. The time now is 06:33 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"