userform combobox naming from shape click

Dingoz2012

Board Regular
Joined
Jan 29, 2012
Messages
163
I am stuck.

My dilemma is that I have some shapes on a worksheet, which when clicked bring up a user form for each individual shape clicked.

I've changed from having 15 individual user forms, to a single user form with a combobox which when a value is selected will save the data to the workbook which is the value of the combobox.

So as it is now I click on Shape 1 (called company 1), and it brings up a user form Called Company 1. Same for Shape 2 (called company 2) etc etc Company 2 has it's own user form

What I want is to be able to click on any shape and have it bring up 1 userform and populate the combobox on that form with the shape name.

EG. Click on Company 1, brings up Main user form and combobox 1 populates with Company 1
Click on Company 2, brings up Main user form and combobox 1 populates with Company 2 etc etc.

Stuck on how to make this happen.

Any suggestions greatly appreciated..
 
Last edited:

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Try this:
Put this script in your Userform.
It runs when you open the UserForm

But I would be interested in knowing why you need numerous UserForms

I have been using Userforms for years and have never needed more then One.
I may be able to help you need only one if you wanted to explain why you need more then one.
If your interested.

Code:
Private Sub UserForm_Initialize()
'Modified  2/20/2019  1:34:27 AM  EST
ComboBox1.AddItem Application.Caller
End Sub
 
Upvote 0
I see now your converting to needing only one Userform.

What will the shape name be?

Will it be the sheet name?

Then why not try this:
It will put the active sheet name in the Combobox

Code:
Private Sub UserForm_Initialize()
'Modified  2/20/2019  1:46:27 AM  EST
ComboBox1.AddItem ActiveSheet.Name
End Sub
 
Upvote 0
Shape names will be different things.

Terminal Names. Such as Terminal 1, Terminal 2, Terminal 3 etc.
Desk Numbers. Such as Desk 13, Desk 14, Desk 15 etc

So when any of those are clicked, the combobox on the userform has to display this name, or I can change it to a textbox.
 
Last edited:
Upvote 0
I see now your converting to needing only one Userform.

What will the shape name be?

Will it be the sheet name?

Then why not try this:
It will put the active sheet name in the Combobox

Code:
Private Sub UserForm_Initialize()
'Modified  2/20/2019  1:46:27 AM  EST
ComboBox1.AddItem ActiveSheet.Name
End Sub

Cheers

Have changed things around slightly now. Made it a textbox on the userform which will display the shape clicked. Which will allow me to have 1 form and one set of code, as I have it saving to different workbooks depending on whats displayed in the text box.

Cheers
 
Upvote 0
Glad I was able to help you.
Come back here to Mr. Excel next time you need additional assistance.
Cheers

Have changed things around slightly now. Made it a textbox on the userform which will display the shape clicked. Which will allow me to have 1 form and one set of code, as I have it saving to different workbooks depending on whats displayed in the text box.

Cheers
 
Upvote 0

Forum statistics

Threads
1,215,680
Messages
6,126,188
Members
449,296
Latest member
tinneytwin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top