Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Is there a method for refreshing an object variable?

Hello

I want to define a range as an object variable at the beginning of the
procedure as a dynamic range.

Does there exist a method that would enable me to refresh the variable when
I need to, later in the code?

Rergards
Uno Kõrsmaa


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default Is there a method for refreshing an object variable?

The only way I know is to set the range each time:

Dim x as Long
Dim rng as Range

x = ????
Set rng = Range("A1:D" & x)

* more code *
x = ????
Set rng = Range("A1:D" & x)

you might use:
x = Cells(Rows.COUNT, "A").End(xlUp).Row
to set x to the last used row in column A
or:
x = Cells(Rows.COUNT, "A").End(xlUp).Offset(1, 0).Row
to set x to the blank row after the last used row in column A.

There might be a way to build an Offset function and evaluate during the
code execution. but I don't know how to do this...

--
sb
"uno@korsmaa" wrote in message
...
Hello

I want to define a range as an object variable at the beginning of the
procedure as a dynamic range.

Does there exist a method that would enable me to refresh the variable

when
I need to, later in the code?

Rergards
Uno Kõrsmaa




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
Runtime Error '91' Object variable or With block variable not set Alec Coliver Excel Discussion (Misc queries) 2 October 24th 09 02:29 PM
Method Add of object Validation Failed - please help Shokie New Users to Excel 1 July 10th 09 01:34 PM
Method Add of object Validation Failed - please help Shokie Excel Worksheet Functions 1 July 10th 09 01:33 PM
Object Variable Not Set Error on Selection object Jean Excel Worksheet Functions 3 July 24th 06 06:45 PM
Method ~ of Object ~ Failed. Joan Excel Programming 5 August 26th 03 08:13 PM


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