Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
WayneB
 
Posts: n/a
Default Copying a spreadsheet with macros

Hi: I have a spreadsheet with macros that I'd like to copy to new
spreadsheets. But when I do the macros open the old file. I've tried
moving the spreadsheet to the new spreadsheets but then it says the macros
don't exist. any ideas? wayne


  #2   Report Post  
David McRitchie
 
Posts: n/a
Default

Hi Wayne,
How are you invoking the macros?
Alt+F8
Toolbar buttons
Menus
Shortcut keys

What does the file reference look like from where you invoke it.

Trying to understand why the macro is okay in one worksheet, but
not in the other. Do you have Event macros that are installed
with a worksheet. Does the following show a macro in the one of the worksheets that works.
Right-click on worksheet tab, View code
--
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"WayneB" wrote in message ...
Hi: I have a spreadsheet with macros that I'd like to copy to new
spreadsheets. But when I do the macros open the old file. I've tried
moving the spreadsheet to the new spreadsheets but then it says the macros
don't exist. any ideas? wayne




  #3   Report Post  
WayneB
 
Posts: n/a
Default

Hi Dave: When I copy the sheet with macros from an old file to a a new file
and invoke it with a button it will spawn the old file. When I move the
sheet, it just says the macros don't exist. Here's the sample code...


Sub SortBDescending()
'
' JobSearchSortDate Macro
' Macro recorded 9/19/2004 by Wayne and Debi
'

'
Range("B2:I1000").Select
Selection.Sort Key1:=Range("B3"), Order1:=xlDescending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
Range("B2").Select
End Sub




"David McRitchie" wrote in message
...
Hi Wayne,
How are you invoking the macros?
Alt+F8
Toolbar buttons
Menus
Shortcut keys

What does the file reference look like from where you invoke it.

Trying to understand why the macro is okay in one worksheet, but
not in the other. Do you have Event macros that are installed
with a worksheet. Does the following show a macro in the one of the
worksheets that works.
Right-click on worksheet tab, View code
--
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"WayneB" wrote in message
...
Hi: I have a spreadsheet with macros that I'd like to copy to new
spreadsheets. But when I do the macros open the old file. I've tried
moving the spreadsheet to the new spreadsheets but then it says the
macros
don't exist. any ideas? wayne






  #4   Report Post  
David McRitchie
 
Posts: n/a
Default

Hi Wayne,
I think you've got it **the button**.

If you use buttons or menus and have more than one workbook those
menus and buttons should be referring to your personal.xls macros.
Watch out when you restore your personal.xls workbook because it can
cause the same problem pointing to an old pathname.


Look at the macro assigned to the button, I think you will find the
old workbook, or the old pathname assigned to the buttons.

If that is not the case, then the following probably won't help you today,
and you'll have to dig up more dirt.

if that was the case then correct them. You might want to read
Barhopper -- fixup for Restored Toolbars, and -- Listing of Menu Items
http://www.mvps.org/dmcritchie/excel/barhopper.htm

You may have to exit out of all visible workbooks and
unhide your personal.xls before correcting your toolbars, don't forget to
make a change to the workbook and then save your workbook,
when you reopen, hide your personal.xls workbook again. Don't know how much of all of that is actually needed but you'd think with
the toolbars in their own files none of that
extra work would have been needed.

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"WayneB" wrote in message ...
Hi Dave: When I copy the sheet with macros from an old file to a a new file
and invoke it with a button it will spawn the old file. When I move the
sheet, it just says the macros don't exist. Here's the sample code...



  #5   Report Post  
WayneB
 
Posts: n/a
Default

Thanks Dave, but I never use personal.xls for macros: Too much sharing of
files with colleagues. The workaround I came up is as follows: export the
macros from the source sheet, move the sheet to the destination workbook
(don't copy because then the macros will path back to the old workbook),
import the .bas file. thx



"David McRitchie" wrote in message
...
Hi Wayne,
I think you've got it **the button**.

If you use buttons or menus and have more than one workbook those
menus and buttons should be referring to your personal.xls macros.
Watch out when you restore your personal.xls workbook because it can
cause the same problem pointing to an old pathname.


Look at the macro assigned to the button, I think you will find the
old workbook, or the old pathname assigned to the buttons.

If that is not the case, then the following probably won't help you today,
and you'll have to dig up more dirt.

if that was the case then correct them. You might want to read
Barhopper -- fixup for Restored Toolbars, and -- Listing of Menu
Items
http://www.mvps.org/dmcritchie/excel/barhopper.htm

You may have to exit out of all visible workbooks and
unhide your personal.xls before correcting your toolbars, don't forget to
make a change to the workbook and then save your workbook,
when you reopen, hide your personal.xls workbook again. Don't know how
much of all of that is actually needed but you'd think with
the toolbars in their own files none of that
extra work would have been needed.

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"WayneB" wrote in message ...
Hi Dave: When I copy the sheet with macros from an old file to a a new
file
and invoke it with a button it will spawn the old file. When I move the
sheet, it just says the macros don't exist. Here's the sample code...





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
How do I stop Macros from opening with every excel spreadsheet? AlexMilos Excel Discussion (Misc queries) 1 January 13th 05 08:44 PM
copying data from Excel spreadsheet to another DavidB Excel Discussion (Misc queries) 1 January 11th 05 12:26 AM
Macros disappear after a file is imported Brent E Excel Discussion (Misc queries) 1 December 18th 04 01:25 AM
Copying spreadsheet with fonts and patterns RTP Excel Discussion (Misc queries) 3 December 10th 04 12:49 AM
Copying an Excel spreadsheet to a Word document KG Excel Discussion (Misc queries) 1 November 28th 04 08:38 PM


All times are GMT +1. The time now is 05:13 PM.

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

About Us

"It's about Microsoft Excel"