• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

macro does not work after renaming workbook

codedreamer

New Member
I have two workbooks, one name BakeSale and one name Receipt. The macro is supose to transfer information from Bake Sale to receipt, but after the workbook is rename it does not work anymore. This is what I have:


'Workbooks("BakeSale.xlsm").Sheets(i).Range("A1").Value =Workbooks("Receipt.xlsm").Sheets(i).Range("A5").Value'


I tried substituting BakeSale for ThisWorkbook and it pass that line, but it does not pass the next even though Receipt has not been rename.

Thank you for your help,


Codedreamer
 
Hi Codedreamer!


First, as a tip, the mark for posting code is backtick (under the Esc key), not a single apostrophe. It's a little confusing I know.


Just to check, is this what you tried before?

Code:
ThisWorkbook.Sheets(i).Range("A1").Value =Workbooks("Receipt.xlsm").Sheets(i).Range("A5").Value


Code is also assuming that the Receipt workbook is already open. If that single line is working okay, perhaps there is something else in the block of code that is doing something funny. I'm presuming that this is in some sort of For...next loop?
 
Do you have any Chart sheets in either workbook? That would cause an error. If you could post more of your code, that would be helpful as well.
 
Back
Top