ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is it possible to open the VBA form with a link in a sheet and to pass variable from a cell to the VBA form? (https://www.excelbanter.com/excel-programming/308316-possible-open-vba-form-link-sheet-pass-variable-cell-vba-form.html)

Daniel[_14_]

Is it possible to open the VBA form with a link in a sheet and to pass variable from a cell to the VBA form?
 
I am new in excel VBA programming and now facing a problem is that:

I have a worksheet containing the company details and each company
contain a unique ID. I have create a VBA form to list the detail of a
specified company using their company ID (I am now hardcode the ID in
the form at this moment). I want to allow users to open the VBA form
to see the company detail by clicking the company ID in the worksheet.
But I do not know how the form link with the company ID in the
worksheet.

Is it possible to call the VBA form with a link? In addition, is it
possible to pass the ID from the worksheet to the form? Or any other
solutions.

Thanks for helping.

Bob Phillips[_6_]

Is it possible to open the VBA form with a link in a sheet and to pass variable from a cell to the VBA form?
 
You would use the RefEdit control, and when the user clicks in this
control,. they can access the worksheet, so to select a cell. You then just
pickup that value, and get any details associated with it.

RefEdit doesn't automatically appear on the toolbox, but you can get it by
right-clicking on the toolbox, and clicking Additional Controls. Then scroll
down that list to the 'RefEdit Ctrl', and check that item. It will then
appear on your toolbox.

But I have to ask, why bother. If the data is in a worksheet, you can use
DataForms on that worksheet, and Excel does it for you.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Daniel" wrote in message
om...
I am new in excel VBA programming and now facing a problem is that:

I have a worksheet containing the company details and each company
contain a unique ID. I have create a VBA form to list the detail of a
specified company using their company ID (I am now hardcode the ID in
the form at this moment). I want to allow users to open the VBA form
to see the company detail by clicking the company ID in the worksheet.
But I do not know how the form link with the company ID in the
worksheet.

Is it possible to call the VBA form with a link? In addition, is it
possible to pass the ID from the worksheet to the form? Or any other
solutions.

Thanks for helping.





All times are GMT +1. The time now is 11:16 PM.

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