I am still new to VBA and still learning as I go. I currently working on a new workbook that is a compilatin of 30+ others. The original documents are pairs of worksheets, one sheet is a report that is filled in, with some data checks, and the other sheet is a label with data from the report.
Most of the code I have is prewritten, I have just made minor changes, and made is so that I have one main code that pulls data from another page to recreates the original documents. The idea is to make more work now creating it whilst I have the time, so that later I can save time implementing any changes.
I have achieved everything I need the new version to do, and was adding error handling when I found an issue. The bulk of my code relies on text on the buttons, which when clicked call the macros for for navigation, and to select the correct data for the report. The code I have found achieves this, and is working is:
Which is then used to in code such as:
Or
When stepping through, Application.Caller is assigned Error 2023, tripping the On Error line.
Does anyone have any suggestions on either a different way to get the text on buttons, or bypass the error?
Most of the code I have is prewritten, I have just made minor changes, and made is so that I have one main code that pulls data from another page to recreates the original documents. The idea is to make more work now creating it whilst I have the time, so that later I can save time implementing any changes.
I have achieved everything I need the new version to do, and was adding error handling when I found an issue. The bulk of my code relies on text on the buttons, which when clicked call the macros for for navigation, and to select the correct data for the report. The code I have found achieves this, and is working is:
VBA Code:
CurrentCat = ActiveSheet.Buttons(Application.Caller).Caption
Which is then used to in code such as:
VBA Code:
CurrentCat = ActiveSheet.Buttons(Application.Caller).Caption
Sheets(CurrentCat).Visible = True
Sheets(CurrentCat).Select
Or
VBA Code:
CurrentBatch = ActiveSheet.Buttons(Application.Caller).Caption
ChemRow = WorksheetFunction.Match(CurrentBatch, Columns(1), 0)
When stepping through, Application.Caller is assigned Error 2023, tripping the On Error line.
Does anyone have any suggestions on either a different way to get the text on buttons, or bypass the error?