I am trying to create, at runtime on a user form in excel, an optionbutton for each worksheet in a workbook. But for some reason i am getting an error of "Constant expression required" on 'Dim optionbut(p) As OptionButton'
Does that mean i have to make it a constant? I changed it to "6" to test this and it didnt give an error but then gives me an "Invalid use of the New Keyword" on 'optionbut(i) = New OptionButton'
What am i doing wrong?
Code:Dim p As Integer p = Sheets.Count Dim optionbut(p) As OptionButton For i = 0 To Sheet.Count - 1 optionbut(i) = New OptionButton




Reply With Quote