Hello, I am using a user Form in excel VB
I have a bunch of text boxes on another form. What set of text boxes i use depend on what illertation I am on, "counter". I am calling the sub which uses the "Select Case" code to figure out which textbox to use.
When I run it, it reaches the call, goes into the sub, and when it exits the sub it screws up. It says "Type miss match"
Intresting note, if you click play again, it works right away untill it runs another illertation through and gets back to that spot.
In the call function in the code below, all variables have Nothing in them when I put my mouse over them in debug. When I say nothing it actually says like textboxy = Nothing
counter has 1 to start.
Here is my code if anyone can help, thanks for any help at all!
and here is the sub! thanks again!
I have a bunch of text boxes on another form. What set of text boxes i use depend on what illertation I am on, "counter". I am calling the sub which uses the "Select Case" code to figure out which textbox to use.
When I run it, it reaches the call, goes into the sub, and when it exits the sub it screws up. It says "Type miss match"
Intresting note, if you click play again, it works right away untill it runs another illertation through and gets back to that spot.
In the call function in the code below, all variables have Nothing in them when I put my mouse over them in debug. When I say nothing it actually says like textboxy = Nothing
counter has 1 to start.
Here is my code if anyone can help, thanks for any help at all!
Code:
Call subcase(textboxy, textboxM, textboxMa, textboxw, textboxd, checkboxx, counter)
and here is the sub! thanks again!
Code:
Sub subcase(textboxy, textboxM, textboxMa, textboxw, textboxd, checkboxx, counter)
Select Case counter
Case 1
Set textboxy = frmNewItemMore.txtYear1
Set textboxM = frmNewItemMore.txtMonth1
Set textboxw = frmNewItemMore.txtweek1
Set textboxd = frmNewItemMore.txtDay1
Set textboxMa = frmNewItemMore.txtPM1
Set checkboxx = frmNewItemMore.chk1
Case 2
Set textboxy = frmNewItemMore.txtYear2
Set textboxM = frmNewItemMore.txtMonth2
Set textboxw = frmNewItemMore.txtweek2
Set textboxd = frmNewItemMore.txtDay2
Set textboxMa = frmNewItemMore.txtPM2
Set checkboxx = frmNewItemMore.chk2
Case 3
Set textboxy = frmNewItemMore.txtYear3
Set textboxM = frmNewItemMore.txtMonth3
Set textboxw = frmNewItemMore.txtweek3
Set textboxd = frmNewItemMore.txtDay3
Set textboxMa = frmNewItemMore.txtPM3
Set checkboxx = frmNewItemMore.chk3
Case 4
Set textboxy = frmNewItemMore.txtYear4
Set textboxM = frmNewItemMore.txtMonth4
Set textboxw = frmNewItemMore.txtweek4
Set textboxd = frmNewItemMore.txtDay4
Set textboxMa = frmNewItemMore.txtPM4
Set checkboxx = frmNewItemMore.chk4
Case 5
Set textboxy = frmNewItemMore.txtYear5
Set textboxM = frmNewItemMore.txtMonth5
Set textboxw = frmNewItemMore.txtweek5
Set textboxd = frmNewItemMore.txtDay5
Set textboxMa = frmNewItemMore.txtPM5
Set checkboxx = frmNewItemMore.chk5
Case 6
Set textboxy = frmNewItemMore.txtYear6
Set textboxM = frmNewItemMore.txtMonth6
Set textboxw = frmNewItemMore.txtweek6
Set textboxd = frmNewItemMore.txtDay6
Set textboxMa = frmNewItemMore.txtPM6
Set checkboxx = frmNewItemMore.chk6
Case 7
Set textboxy = frmNewItemMore.txtYear7
Set textboxM = frmNewItemMore.txtMonth7
Set textboxw = frmNewItemMore.txtweek7
Set textboxd = frmNewItemMore.txtDay7
Set textboxMa = frmNewItemMore.txtPM7
Set checkboxx = frmNewItemMore.chk7
End Select
End Sub