Quantcast
Channel: Tech Support Guy
Viewing all articles
Browse latest Browse all 29110

Excel - combo to default to formula result

$
0
0
Right, hopefully a quick one.
I have an Excel workbook with 6 sheets, 5 of which are named Monday thru Friday.

On the 6th worksheet, I have inserted an ActiveX combo box called DayCombo.
The combo is populated from a list on the same worksheet (AA2:AA6). The values are the weekdays Monday thru Friday.
I've set the linked cell (AB2).
I've set all the combo box properties as desired.
This works fine, and no code used so far.

Now I need to set the combo to display a default value, which is the result of this formula:
=IF(WEEKDAY(NOW())<=5,UPPER(TEXT(WEEKDAY(NOW()+1),"dddd")),UPPER(TEXT(WEEKD AY(2),"dddd")))
I've put this formula into cell AC2.

The user should be able to leave the combo value as this default, or select a different day if required.
The plan is, depending on which day is selected in the combo (default or otherwise), when a button is clicked some data will be moved from this worksheet to the relevant day's worksheet.

So, how do I get the combo to default to the day returned by the formula result?
I'm guessing I may have to add a Worksheet_Activate() Sub under ThisWorkbook and set the default in there? How would I code this?
I'm wondering if I ought to be populating the combo in code as well, rather than having a list in the worksheet, which I'm going to have to hide and protect.

Thanks!

G

Viewing all articles
Browse latest Browse all 29110

Trending Articles