ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   What is the real name? (https://www.excelbanter.com/excel-programming/341956-what-real-name.html)

Ken McLennan[_3_]

What is the real name?
 
G'day there One & All,

I just have a quick question to try to clarify how something
works. My WorkBook contains 8 WorkSheets. Oddly enough, the Project
Browser shows a tree of 8 WorkSheets named: Sheet1(Main); Sheet2
(Roster); Sheet3(Staff); etc.

The Properties Window indicates that each sheet has a "(Name)",
eg. "Sheet6", and a "Name", eg. "Equity". I know that they don't refer
to the same thing, but what is the difference between the 2?

I have previously used the "(Name)" to refer to each sheet by
changing its value. Eg. Sheet1(Main) became "mSht". This allowed me to
use such constructs as "mSht.Range("Groups").clearcontents". However in
some circumstances, which I never understood & so can't really explain,
this didn't work & I had to also "Dim mSht as WorkSheet" and then "Set
mSht = WorkSheets("Main")". Why is this?

Can someone either explain, or point me to a web based description
of what & why? My current code had a bit of difficulty referring to one
of the sheets so I changed them all back to the "Sheet1(Main)" format
and Dimmed and Set all over the place to compensate. I can't see what
the problem was and I found it easier to refer to sheets as "mSht".

Is it that the (Name) represents the WorkSheet object for the
particular sheet, while Name is just a property? That's the only
scenario I could think of, but I still don't quite grasp the possible
ramifications.

Thanks for listening,
--
Ken McLennan
Qld, Australia

Tom Ogilvy

What is the real name?
 
(name) is the code name.

See Excel VBA help on codename.

See Chip Pearson's page on this as well:
http://www.cpearson.com/excel/codemods.htm

--
Regards,
Tom Ogilvy


"Ken McLennan" wrote in message
.. .
G'day there One & All,

I just have a quick question to try to clarify how something
works. My WorkBook contains 8 WorkSheets. Oddly enough, the Project
Browser shows a tree of 8 WorkSheets named: Sheet1(Main); Sheet2
(Roster); Sheet3(Staff); etc.

The Properties Window indicates that each sheet has a "(Name)",
eg. "Sheet6", and a "Name", eg. "Equity". I know that they don't refer
to the same thing, but what is the difference between the 2?

I have previously used the "(Name)" to refer to each sheet by
changing its value. Eg. Sheet1(Main) became "mSht". This allowed me to
use such constructs as "mSht.Range("Groups").clearcontents". However in
some circumstances, which I never understood & so can't really explain,
this didn't work & I had to also "Dim mSht as WorkSheet" and then "Set
mSht = WorkSheets("Main")". Why is this?

Can someone either explain, or point me to a web based description
of what & why? My current code had a bit of difficulty referring to one
of the sheets so I changed them all back to the "Sheet1(Main)" format
and Dimmed and Set all over the place to compensate. I can't see what
the problem was and I found it easier to refer to sheets as "mSht".

Is it that the (Name) represents the WorkSheet object for the
particular sheet, while Name is just a property? That's the only
scenario I could think of, but I still don't quite grasp the possible
ramifications.

Thanks for listening,
--
Ken McLennan
Qld, Australia




Ken McLennan[_3_]

What is the real name?
 
G'day there Tom,

(name) is the code name.

See Excel VBA help on codename.

See Chip Pearson's page on this as well:
http://www.cpearson.com/excel/codemods.htm


Thanks very much for that information. I've had a quick peruse of
Chip's page, but didn't understand it all that well. Hence I've
downloaded it for printing today. (I'll get the hang of this Excel thing
yet!!). I've not looked at the Help file yet, but that too is on my
agenda.

Thank you for your very prompt assistance. I really do appreciate
it. I know that I'd not have gotten very far without the willingness of
you & your fellow professionals to help on this forum. Which leads to
the question: Where on earth do find the time to fit it in?!! <g My
wife complains when I spend an hour or two at the computer!

Thanks again,
See ya,
--
Ken McLennan
Qld, Australia

Piranha[_52_]

What is the real name?
 

Hi Ken,
Some additional info for you.

http://vbaexpress.com/forum/showthre...hlight=piranha

Dave
Ken McLennan Wrote:
G'day there One & All,

I just have a quick question to try to clarify how something
works. My WorkBook contains 8 WorkSheets. Oddly enough, the Project
Browser shows a tree of 8 WorkSheets named: Sheet1(Main); Sheet2
(Roster); Sheet3(Staff); etc.

The Properties Window indicates that each sheet has a "(Name)",
eg. "Sheet6", and a "Name", eg. "Equity". I know that they don't refer
to the same thing, but what is the difference between the 2?

I have previously used the "(Name)" to refer to each sheet by
changing its value. Eg. Sheet1(Main) became "mSht". This allowed me to
use such constructs as "mSht.Range("Groups").clearcontents". Howeve
in
some circumstances, which I never understood & so can't reall
explain,
this didn't work & I had to also "Dim mSht as WorkSheet" and then "Set
mSht = WorkSheets("Main")". Why is this?

Can someone either explain, or point me to a web based description
of what & why? My current code had a bit of difficulty referring t
one
of the sheets so I changed them all back to the "Sheet1(Main)" format
and Dimmed and Set all over the place to compensate. I can't see what
the problem was and I found it easier to refer to sheets as "mSht".

Is it that the (Name) represents the WorkSheet object for the
particular sheet, while Name is just a property? That's the only
scenario I could think of, but I still don't quite grasp the possible
ramifications.

Thanks for listening,
--
Ken McLennan
Qld, Australi


--
Piranh
-----------------------------------------------------------------------
Piranha's Profile: http://www.excelforum.com/member.php...fo&userid=2043
View this thread: http://www.excelforum.com/showthread.php?threadid=47336



All times are GMT +1. The time now is 06:02 PM.

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