Hi there,
I keep thinking that this is one of those posts that I should already know the answer to, but I still seem to be struggling!
All I want to do is write a reference to a cell that includes the workbook name, the sheet and then the cell. Yet for whatever reason, I get a run-time error 9.
The line in question if this:
Code
Application.Workbooks("Tracing precedents").Sheets("Sheet3").Range("A65536").End(xlUp).Offset(1, 0).Value = ActiveWorkbook.Name
As you'll see, what I am trying to do is put the name of the activeworkbook into sheet3 of my "Tracing precedents" book, (where "Tracing Precedents" is obviously not the active book).
Although I know that I could set a variable equal to the name of the activeworkbook, and then split my code as follows, I feel that this would be a bit of a bodge, and that there must be a better way.
ie.
Code
Dim Workbook_Name as string
Workbook_Name=activeworkbook.name
Workbooks("Tracing Precedents").select
Sheets("Sheet3").range...................................etc.=Workbook_Name
Many thanks for all your help,
Rich