ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Set Worksheet Names in a Module (https://www.excelbanter.com/excel-discussion-misc-queries/100281-set-worksheet-names-module.html)

Noemi

Set Worksheet Names in a Module
 
Hi
Example:

set wksCurrent = worksheets("Testing")
set wksNew = worksheets("Antoher")

as the same names can be used over each sheet instead of having to enter
code in as Sheets("Testing").cmdTest.visible = true
I was hoping to cut it down to be wkscurrent.cmdtest.visible = true

Any help aprreciated.
Thanks
Noemi

Dave Peterson

Set Worksheet Names in a Module
 
You could use:

wkscurrent.OLEObjects("CommandButton1").Visible = False

Or you could use the CodeName (look at the properties of the worksheet when
you're in the VBE)

Sheet1.CommandButton1.visible = true

Inside the VBE
hit ctrl-r (to see the project explorer
Click on the worksheet
hit F4 to see the properties of that sheet
the property called (Name) -- with the parentheses
is the codename.

You can type over that name to get something more meaningful, too.

Maybe Testing???

then
Testing.commandbutton1.visible = true
would work



Noemi wrote:

Hi
Example:

set wksCurrent = worksheets("Testing")
set wksNew = worksheets("Antoher")

as the same names can be used over each sheet instead of having to enter
code in as Sheets("Testing").cmdTest.visible = true
I was hoping to cut it down to be wkscurrent.cmdtest.visible = true

Any help aprreciated.
Thanks
Noemi


--

Dave Peterson


All times are GMT +1. The time now is 07:14 AM.

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