Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Advice needed regarding Comboboxes and Editing Data using VBA and Excel 2010 1

Status
Not open for further replies.

JasonEnsor

Programmer
Sep 14, 2010
193
GB
Hi,

I am using a userform built in Excel to populate a spreadsheet, which works fantastically (even if i do say so myself), however i have a slight problem with amending the data.

The userform contains several comboboxes with a set of possible choices, these choices relate to a customers payment (P - Paid, H- Holiday, PH - Paid Holiday etc..) depending on what the user selects determines what action is taken by the spreadsheet, for example PH would insert a date for a holiday which it gets from a label control on the userform in to a holiday list. This happens on the Change Event of the combobox which worked great until i needed to start amending the data.

My initial thought when trying to amend the data was to read the values from the spreadsheet and repopulate the comboboxes, however this now fires off the Change Event and would add the holiday again etc... I am using Comboboxes as it restricts the user to only be able to select the list of possible values i provide. There are 5 Comboboxes which depending on the situation of a users account can have up to 6 possible notations that can be used, so checkboxes are not a viable option.


Does anyone have anythoughts on what i could do? I am trying to not go down the route of having a special form for editing and updating user details as sometimes we might get payment for only 3 out of 5 weeks then the following week get the following 2 weeks paid for.


Any thoughts would be appreciated. I can explain anything in more detail if needed


Regards

Jason
 
What is the Style property of your combo boxes?

If you want them to "restrict the user to only be able to select the list of possible values i provide", I would set it to 2 - fmStyleDropDownList

Have fun.

---- Andy
 
You can use a flag for determining a type of user action. If the user changes customers action, the flag is set to False, comboboxes repopulated, and flag reset to True. "Change" event procedures for comboboxes can have a big "If...End If" block that is executed if the flag is True.
Another option is to use a button to transfer data to a worksheet.
Unfortunatelly, there is no EnableEvents property for userforms, so one has to use a workaround.

combo
 
Cheers for the replies guys, I think your idea will work brilliantly combo. I will test it out this weekend.

Many Thanks

Jason.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top