Hi Guys !
How to get Excel Built-In Data Form by VBA code on sheet other than data, like i want to display Data Form on Sheet1 and my data is stored in a Table on another sheet named "Data".
i tried following code of line but it gives error.
Sheets("Data").ShowDataForm
Hi Irfan,
So you want to display a form whilst Sheet1 is active, but the form loads data from a sheet called Data?
It doesn't matter what sheet is active, you can display the form anytime. If your form is called MyForm then calling the .Show method will display it e.g.
MyForm.Show
You must write the code that then loads the data from the Data sheet into the form.
Without seeing your workbook I'm just guessing here as to what your form is doing.
You can read about building forms here
https://www.myonlinetraininghub.com/excel-forms
and I have written more posts on forms
https://www.myonlinetraininghub.com/tag/userforms
Regards
Phil
Hi Irfan
I am assuming:
1) You want to use the built-in form found in the QAT - More Commands - All Commands - Form...
2) Your data is in the Data sheet
3) You want to display the built-in form from another sheet other that the Data sheet.
Give this a try
Sub ShowForm()
Dim ws As Worksheet
Set ws = Sheets("Data")
ws.ShowDataForm
End Sub
Hope this helps.
Sunny
Thanks for help, i tried following code and it works for me.
Application.ScreenUpdating = False
Sheets("Data").Activate
ActiveSheet.ShowDataForm
Sheets("SwitchBoard").Activate
Switchboard is sheet name.