Tigerexcel
Active Member
- Joined
- Mar 6, 2020
- Messages
- 493
- Office Version
- 365
- 2019
- Platform
- Windows
I'm trying to insert an input box whereby the user just selects a worksheet, rather than having to type it in.
So far I have,
Dim Sheetname As String
If ActiveWorkbook Is Nothing Then Exit Sub
Sheetname = Application.InputBox("Where is the source data?")
Sheets(Sheetname).Select
When you select the worksheet, it will write it in with exclamation mark eg =Attendance!, the macro then returns an error message asking me to check my formulae, so it is a range issue.
However if I simply type Attendance in the input box, it works fine., if I select =Attendance! and remove the equal sign and the exclamation mark, it works fine. How can I amend the code so that the user simply just clicks onto the required worksheet?
So far I have,
Dim Sheetname As String
If ActiveWorkbook Is Nothing Then Exit Sub
Sheetname = Application.InputBox("Where is the source data?")
Sheets(Sheetname).Select
When you select the worksheet, it will write it in with exclamation mark eg =Attendance!, the macro then returns an error message asking me to check my formulae, so it is a range issue.
However if I simply type Attendance in the input box, it works fine., if I select =Attendance! and remove the equal sign and the exclamation mark, it works fine. How can I amend the code so that the user simply just clicks onto the required worksheet?