Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Fix multiple 'assign macro' references broken due to moving sheet

I'm mystified as to why this happened, but I'm hoping someone can help me fix
it in an easy way...
I have a workbook with multiple sheets, and many buttons with assigned
macros on different sheets for navigation, filtering, etc.
I created a new blank sheet within the workbook for a throwaway calculation,
and then decided I didn't want it in that book so right clicked and moved to
a new book. That was fine and I proceeded with my calculating for a while.
Then I went back to the original book and tried to use a button, but got an
error that the macro did not exist, referencing 'Book12', the new book
created with my calculation sheet. I figured something odd had happened with
moving the sheet, so I moved it back again, but now clicking a button gives
me 'Book12.htm cannot be found...'

I really don't want to have to go through each one and reassign all the
macros one at a time - is there any way of fixing this straightforwardly?

Note: The macros themselves are saved in a module within the workbook, not
on any individual sheet. This is what makes the whole thing so odd.
Removing the 'Book12!' from the start of each reference makes it work fine
again.

Thanks in advance for any help!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Fix multiple 'assign macro' references broken due to moving sheet

I can't reproduce what you describe, most odd!

Maybe this macro will reset your onAction links

Sub test()
Dim btn As Button
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
For Each btn In ws.Buttons
btn.OnAction = Replace(btn.OnAction, "Book12!", "")
Next
Next
End Sub

Regards,
Peter T



"Tara H" wrote in message
...
I'm mystified as to why this happened, but I'm hoping someone can help me
fix
it in an easy way...
I have a workbook with multiple sheets, and many buttons with assigned
macros on different sheets for navigation, filtering, etc.
I created a new blank sheet within the workbook for a throwaway
calculation,
and then decided I didn't want it in that book so right clicked and moved
to
a new book. That was fine and I proceeded with my calculating for a
while.
Then I went back to the original book and tried to use a button, but got
an
error that the macro did not exist, referencing 'Book12', the new book
created with my calculation sheet. I figured something odd had happened
with
moving the sheet, so I moved it back again, but now clicking a button
gives
me 'Book12.htm cannot be found...'

I really don't want to have to go through each one and reassign all the
macros one at a time - is there any way of fixing this straightforwardly?

Note: The macros themselves are saved in a module within the workbook, not
on any individual sheet. This is what makes the whole thing so odd.
Removing the 'Book12!' from the start of each reference makes it work fine
again.

Thanks in advance for any help!



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
Multiple sheet references in one function Alex Excel Worksheet Functions 0 May 25th 10 06:18 PM
Assign Macro with Hidden Sheet Pran Excel Worksheet Functions 5 August 4th 09 01:32 PM
Named references broken on copied worksheet DNicolay Excel Discussion (Misc queries) 0 December 12th 05 04:49 PM
Assign macro broken after reference removed Trefor Excel Programming 2 November 14th 05 04:06 PM
Broken References Gareth[_3_] Excel Programming 1 February 21st 04 04:29 PM


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