Is it possible to open the VBA form with a link in a sheet and to pass variable from a cell to the V

D

Daniel

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.
 
B

Bob Phillips

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
Data>Forms 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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top