I have an excel sheet that has 12 ranges, one for each month. All of the ranges are on the same sheet. All ranges are identical, except for the data.
I have a combobox that has the 12 months as the options.
I am trying to write a function that populates cells on a "recap" sheet based on the month chosen in the combobox.
This function is basically an offset function, but I want the reference to the range be the same as the combobox choice.
I have tested the function without the case and it works fine when I manually set txt1 to "January", so I am thinking it is a problem with the case.
I have a combobox that has the 12 months as the options.
I am trying to write a function that populates cells on a "recap" sheet based on the month chosen in the combobox.
This function is basically an offset function, but I want the reference to the range be the same as the combobox choice.
Code:
Public Function roff(x As Integer, y As Integer)
Select Case ComboBox1.Text
Dim txt1 As String
Case "January"
txt1 = "January"
Case "February"
txt1 = "February"
.......
roff = Range(txt1).Range("A1").Offset(x, y).Value
End Select
End Function
I have tested the function without the case and it works fine when I manually set txt1 to "January", so I am thinking it is a problem with the case.