LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro Name problem when I change workbook name?

In case you can't see your other post, Jake Marx posted this and I think it
is probably what you want:

Does your code look like this?

Workbooks("ABC.xls").Sheets("Sheet1").Range("A1"). Value=1

If so, change it to:

ThisWorkbook.Sheets("Sheet1").Range("A1").Value=1

ThisWorkbook will always return a reference to the workbook in which the VBA
code resides, so you don't have to worry about name changes.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

"Mike" wrote in message
oups.com...
Tom,

My Macro doesn't have a code! My macro just performs few operations
using Tools, Macro, Record New Macro...etc.

I opened ABC.xls file and saved it as, using saveas, as DEF.xls

Next, I pushed the button that my macro is linked to but gave me again
an error "out of range" and the file closed!
HOW can I prevent this?

Thanks,
Mike





 
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
Macro change problem Dr Hackenbush Excel Discussion (Misc queries) 3 February 6th 10 04:54 PM
Macro broken with workbook name change Annabelle Excel Discussion (Misc queries) 2 February 3rd 06 12:48 AM
Macro to change worksheets in the same workbook James C Excel Discussion (Misc queries) 2 October 19th 05 08:04 PM
Problem closing a workbook using a macro Steve Excel Programming 3 September 21st 04 01:03 PM
A Macro to change macros? VBA problem MrMerton Excel Programming 2 July 6th 04 02:06 PM


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