ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to bring up a data form with VBA (https://www.excelbanter.com/excel-programming/275936-how-bring-up-data-form-vba.html)

Paul James[_3_]

how to bring up a data form with VBA
 
I've got a table of data that I would like to display in Excel's built-in
data form that you can call up manually by highlighting a range of data and
selecting the Form command from the Data menu. However, I would like to
write a VBA procedure that would enable the user to do this by simply
clicking on the command button.

The region I would like to display in this form could be described as

Range("DataTable").CurrentRegion

Can anyone tell me what code I can use to bring up Excel's built-in data
form to display the data in that range?

Thanks in advance.

Paul



Paul James[_2_]

how to bring up a data form with VBA
 
Thanks for your help again, Tom.



Tom Ogilvy

how to bring up a data form with VBA
 
My mistake. Glad you fixed it.

--
Regards,
Tom Ogilvy

Paul James wrote in message
...
Actually a small modification is needed to get the code to work.
ShowDataForm isn't a method of the Application object, but it is a method

of
the ActiveSheet object. So the working code would be:

Range("DataTable").CurrentRegion.Name = "Database"
ActiveSheet.ShowDataForm

Again, thanks for showing me how to do this, Tom.

Paul






All times are GMT +1. The time now is 03:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com