AndyTampa
Board Regular
- Joined
- Aug 14, 2011
- Messages
- 199
- Office Version
- 365
- 2016
- Platform
- Windows
I've tried searching here and Google and just can't seem to ask the right way to get the right search results.
I put a personal macro in my Quick Access Toolbar to use on a spreadsheet I use every day. I make a new one every month. When there is too much text in a cell, it merges with the 4 cells next to it and corrects the height automatically.
The problem I have is when I accidentally run the macro (via the Quick Access button) on a different sheet or workbook. The macro runs and there is no "undo". I'm trying to find a way for this button to only work when I am on a particular tab named "Packages Worked" on a workbook that always has "Packages Worked" in the title.
If I'm not on the sheet or it isn't even open, I just want a MsgBox that the macro only works on that particular sheet. I tried the below line, but it got a debug error when the workbook was closed and I was in another workbook.
I don't even have a clue how to check if the workbook name contains specific text. It seems like it would be simple, but searching for the information is getting me all the wrong answers.
I put a personal macro in my Quick Access Toolbar to use on a spreadsheet I use every day. I make a new one every month. When there is too much text in a cell, it merges with the 4 cells next to it and corrects the height automatically.
The problem I have is when I accidentally run the macro (via the Quick Access button) on a different sheet or workbook. The macro runs and there is no "undo". I'm trying to find a way for this button to only work when I am on a particular tab named "Packages Worked" on a workbook that always has "Packages Worked" in the title.
If I'm not on the sheet or it isn't even open, I just want a MsgBox that the macro only works on that particular sheet. I tried the below line, but it got a debug error when the workbook was closed and I was in another workbook.
VBA Code:
If ActiveWorkbook.Worksheets("Packages Worked") Is ActiveSheet Then
I don't even have a clue how to check if the workbook name contains specific text. It seems like it would be simple, but searching for the information is getting me all the wrong answers.