Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default button names changed on copied sheet

These damn buttons....

I have a collection of form buttons on sheet. They are all assigned to the same sub(). In that sub() I obtain their name:

Dim button_name As String: button_name = Application.Caller

When I do a copy sheet (leftclick tab, move or copy, x create copy) everything is just fine EXCEPT the buttons have changed their names.

Select Case button_name
Case "Button 2"
row_day = oMyWs.Range("row_day_1").row
Case "Button 3"
row_day = oMyWs.Range("row_day_2").row

The above fails because "Button 2" is now "Button 1". There is no "Button 1" on the source page (probably having been deleted during development)

What gives? Can I fix this or am I doomed.

Thank you.
Excel 2010


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default button names changed on copied sheet

See my reply to your other post! My suggestion fixes all unexpected
behaviors associated with using controls on worksheets...

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion



---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default button names changed on copied sheet


Garry...
See my reply to your other post! My suggestion fixes all unexpected
behaviors associated with using controls on worksheets...

The source sheet contained buttons "Button 2"....3,4,5,6

This worked

Set shp2 = ws.Shapes.Item("Button 2")
shp2.Name = "Button 1"

But this failed

Set shp2 = ws.Shapes.Item("Button 3")
shp2.Name = "Button 2"

I reloaded the object... still failed. That name persists somewhere but I couldn't find it. I dumped the names and "Button 2" was not in use. I finally mangled them but good, as in

"ButtonDay1", "ButtonDay2" ..... 14

and everything renamed just fine.

Thanks.
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default button names changed on copied sheet

Garry...
See my reply to your other post! My suggestion fixes all unexpected
behaviors associated with using controls on worksheets...

The source sheet contained buttons "Button 2"....3,4,5,6

This worked

Set shp2 = ws.Shapes.Item("Button 2")
shp2.Name = "Button 1"

But this failed

Set shp2 = ws.Shapes.Item("Button 3")
shp2.Name = "Button 2"

I reloaded the object... still failed. That name persists somewhere
but I couldn't find it. I dumped the names and "Button 2" was not in
use. I finally mangled them but good, as in

"ButtonDay1", "ButtonDay2" ..... 14

and everything renamed just fine.

Thanks.


FOR NOW!!! See what happens next time you hide/unhide the area...

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion



---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

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
When a sheet is copied, i want also that the Sub's whithin this sheet is copied to the new sheet Luc[_8_] Excel Programming 2 January 12th 10 05:49 AM
The column names (A,B,C, etc...) changed to numbers?????????? Jenner Setting up and Configuration of Excel 1 May 27th 09 06:53 PM
Duplicate names on copied worksheet Pat Conover Links and Linking in Excel 0 March 20th 06 11:36 AM
The columns names on my sheet have changed!! so_moody Excel Discussion (Misc queries) 2 August 15th 05 12:16 PM
names changed somehow choice[_2_] Excel Programming 1 February 5th 05 06:29 AM


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