Hi,
I would like to make a cell in my workbook show the name of the workbook.
The sheet where I want it to show is called INPUT SHEET and the cell is "AY2"
I have tried the following:
fname = ActiveWorkbook.Name
Range("AY2").Value = Left(fname, InStr(1, fname, ".xls") - 1)
This code is inserted in This Workbook under Private Sub workbook_open.
The code works but I keep getting a runtime error when opening the workbook that points to second line above. IT says "Application-defined or object defined error"
Anyone know what could be causing this? should I place the code somewhere else?
Br
timwe
I would like to make a cell in my workbook show the name of the workbook.
The sheet where I want it to show is called INPUT SHEET and the cell is "AY2"
I have tried the following:
fname = ActiveWorkbook.Name
Range("AY2").Value = Left(fname, InStr(1, fname, ".xls") - 1)
This code is inserted in This Workbook under Private Sub workbook_open.
The code works but I keep getting a runtime error when opening the workbook that points to second line above. IT says "Application-defined or object defined error"
Anyone know what could be causing this? should I place the code somewhere else?
Br
timwe
Last edited: