Once again I want to learn how to simplify my code.
I have a userform with two frames each containing two comboboxes.
( Frame1 > Category1 > Item1 and Frame2 > Category2 > Item2)
In the BeforeUpdate event of both ‘Category’ comboboxes, I populate the corresponding ‘Item’ combobox from a filtered range.
The code for each (see below) is almost identical. The exception being the numbers: 1 and 2.
My goal is to write the code once only and then call it in the BeforeUpdate events, but I can’t figure out how to go about it.
I have worked out if I ‘Dim i As Integer , i = 1’ then Me.Controls(“Category” & i).Value is the same as Me.Category1.Value, but I can’t get any further.
It's not at all clear to me how to call a subroutine when there are variables involved.
Any help appreciated.
Bookmarks