Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Worksheet name anomalies

Can someone please expain...
I have a form that, when loaded, initialises a "Worksheet" variable to
point to a certain worksheet...
In the general declarations section:
Dim DELSHEET As Worksheet

In the UserForm_Activate sub:
Set DELSHEET = Worksheets("DEL NOTE")

The "DEL NOTE" worksheet is Sheet4 also.

Throughout different subs in the form I reference the DELSHEET with no
worries. The problem is when I need to reference a textbox on the Del
Note worksheet. In VBA code when I type "DELSHEET" + "." I get the
usual list of properties/methods for the worksheet. However, when I use
the sheet's excel name: "Sheet4" + "." I get the usual list plus the
textboxes and objects that I added in that sheet with the control
toolbox (which is what I want).

How come it works for one and not the other? I thought they would be
the same?

I would prefer to use the DELSHEET variable name rather than Sheet4 as
sheets can get moved around. When I deliberately type:
DELSHEET.TextBox1.Text = "something"
I get a method/data member error... so that doesn't work.

-Scrawny.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Worksheet name anomalies


You misinterpret the benefits of usgin CODEnames.
Users can rename sheets and move but they cannot rename the
CODEnames of the sheet without going into VBE.

it is good practice to reference the sheets you''re working with
via their CODEname. and dispense with the wks object variables.
or qualifiers like Thisworkbook.worksheets("My Fourth Sheet")

e.g.
sheet4.Range(x)

ofcourse for code clarity you could set the CODEname
to s't more descriptive.



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


wrote in
roups.com

I would prefer to use the DELSHEET variable name rather than Sheet4 as
sheets can get moved around. When I deliberately type:
DELSHEET.TextBox1.Text = "something"
I get a method/data member error... so that doesn't work.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Worksheet name anomalies

Awww..... OFCOURSE!!! Why didn't I think of that earlier... stupid,
stupid, stupid.
It's all so simple! Just rename the sheets in the properties window.

Thanks m8.

Cheerio!

:o)

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
Find anomalies in a list of data sarahphonics Excel Discussion (Misc queries) 0 April 26th 10 11:13 AM
automatically appending newly added data on worksheet to a master list worksheet tabylee via OfficeKB.com Links and Linking in Excel 0 December 17th 09 04:24 PM
=countbycolor anomalies Bilbert Excel Worksheet Functions 3 December 7th 06 02:18 PM
graph ignoring anomalies rjkmidget Charts and Charting in Excel 1 December 1st 06 04:58 PM
Command Button anomalies RWN Excel Discussion (Misc queries) 5 May 4th 05 05:09 AM


All times are GMT +1. The time now is 01:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"