Hi
This will hopefully be fairly straight forward.
I would like to reference the current worksheet in vba code so that I can activate the sheet that is running the code. I need to do this as I am switching between 2 wordbooks and the workbook name in 1 instance is not fixed.
I tried retrieving the workbook name like this:
Function WorkbookName() As String
WorkbookName=ThisWorkbook.Name
End Function
but could not work out how to implement that in code such as:
Windows("filepath.xlsm").Activate
Windows.WorkbookName.Activate
The above does not work and I tried a few variations
I did not know how to deal with the quotation marks and parenthesis.
I have another option, the workbook name is contained in a cell on a worksheet within the workbook, the name is in text form minus the .xlsm part so this might be of use.
Can anybody possibly help me achieve the desired outcome?
Many thanks in advance, your wisdom is always appreciated.
Regards,
Michael.
Bookmarks