Forum

VBA For Show DataFo...
 
Notifications
Clear all

VBA For Show DataForm

4 Posts
3 Users
0 Reactions
382 Views
(@irfan454)
Posts: 12
Eminent Member
Topic starter
 

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

 
Posted : 17/10/2018 4:49 am
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

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

 
Posted : 17/10/2018 8:20 am
(@sunnykow)
Posts: 1417
Noble Member
 

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

 
Posted : 17/10/2018 10:06 am
(@irfan454)
Posts: 12
Eminent Member
Topic starter
 

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.

 
Posted : 18/10/2018 6:18 am
Share: