Reputation: 157
I have 2 comboboxes. The 1st combobox (CboReviewDate) holds dates. The 2nd combobox (CboReviewModule) will be populated with the names of all the worksheets in the active workbook (if they contain a date in column "x" that matches the date selected in CboReviewDate).
I need help setting up the logic and choosing the correct search tool. Will this logic flow work? Will the loop routine erase the existing entry in CboReviewModule?
This is a learning process for me, so I would like to develop the code myself. Please just point me in the right direction.
Here is my pseudocode:
'Run on "CboReviewDate"_change state
'CountIf (date in column "x" = "CboReviewDate.Value") in worksheet 1 of active workbook
'if result <> 0 then pass name of worksheet to variable "a"
'.additem to "CboReviewModule" using value of variable "a"
'reset value of variable "a" and loop until all worksheets in active workbook have been searched
Upvotes: 0
Views: 115
Reputation: 2708
Okay, so here's me pointing you in the right/possible/some? direction.
Change
event when you select a dateWorkbook.Worksheets
collection)Worksheet
for the date in Column XFind
method of object Range
(record macro for Ctrl+F
and see how it works), but be careful about the error handling (when match is not found) Worksheet.Name
is added to the item collection of your first combobox.Upvotes: 1