Jan 16 2022 09:59 PM
Hi,
I wonder if someone can help me again.
I have a worksheet with a hidden data sheet.
On one sheet there is a button that has an assigned macro to do the following:
- Unhide the data sheet
- open a form
- allow the user to enter new details
- once closed, hide the data sheet and return to initial sheet.
When I do this manually, (and when recording a macro doing this), I have no issues. However when ran as a macro, the form appears but upon trying to enter data i get the error message "Cannot Extend table or database"
VBA looks like this:
Sub AddDriverForm()
'
' AddDriverForm Macro
'
'
Sheets("AM Report").Select
Sheets("Driver Data").Visible = True
Sheets("Driver Data").Select
Application.Goto Reference:="Driverdata"
ActiveSheet.ShowDataForm
Sheets("Driver Data").Select
ActiveWindow.SelectedSheets.Visible = False
End Sub
Am i missing something obvious?
Jan 17 2022 06:14 AM
I didn't get an error in a quick test. Could you attach a small sample workbook demonstrating the problem?
Jan 17 2022 05:59 PM - edited Jan 17 2022 06:52 PM
Hi Hans,
Here is the link to the workbook i am working on with the data removed.
The sheets in question are AM Report and the Driver Data sheet.
Thank you so much for the assistance.
https://1drv.ms/x/s!AjkmikH6M6FfgaEStXsEuuu7uy1Qdg?e=2QfC0l
Tom
Jan 18 2022 02:55 AM
SolutionThanks! The Data Form is rather primitive. It expects the table to begin in row 1. If you delete the current row 1, the code should work. You don't even need to unhide the sheet: you can use
Sub AddDriverForm()
Sheets("Driver Data").ShowDataForm
End Sub
Jan 18 2022 04:09 PM
Jan 18 2022 02:55 AM
SolutionThanks! The Data Form is rather primitive. It expects the table to begin in row 1. If you delete the current row 1, the code should work. You don't even need to unhide the sheet: you can use
Sub AddDriverForm()
Sheets("Driver Data").ShowDataForm
End Sub