S
Susan
dear gurus -
i'm in waaaay over my head. i THINK i understand this theory...... to
explain:
i have a userform w/a 3-page multipage.
each multipage has (approx.) 4 frames on it
each frame has 3-5 option buttons in it.
the purpose of the userform is to incrementally add "1" to each
evaluation question on the worksheet.
Question 1 (frame name is Q1)
5 (optionbutton name is Q1Opt5)
4 (optionbutton name is Q1Opt4)
3 (name is Q1Opt3)
Question 2 (frame name is Q2)
5 (name is Q2Opt5)
4 (name is Q2Opt4)
3 (name is Q2Opt3)
and so forth. the worksheet ranges correspond:
Set r1 = ws.Range("d8:j13")
Set r2 = ws.Range("d18:j23")
Set r3 = ws.Range("d28:j33")
so, i want to go thru each frame, find the option button that is
selected, find THAT # option button in the corresponding range, find
the correct row, and add 1 to the correct column in the correct row in
the correct range. i'm using iCtr as the numeral for each frame.
this is what i've got so far..............
Dim iCtr As Long
'this is how i can incrementally check each frame
For iCtr = 1 To 13
If TypeOf oControl Is msforms.Frame Then
oControl = "Frame" & iCtr
'now i need to see which option button = true within each frame...
For Each oControl In oControl
If oControl("Q" & iCtr & "Opt1").Value = True Then
sRange = "r" & iCtr
sCaption = oControl("Q" & iCtr & "Opt1").Caption
'the captions of each option button are 1, 2, 3, etc.
Set rFound = myRange.Find(What:=sCaption, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
MatchCase:=False)
If rFound Is Nothing Then
MsgBox "Caption not found in range"
End If
myRow = rFound.Row
'column i contains the numeric that needs incrementing
Set myRange = ws.Range("i" & myRow)
myRange.Value = myRange.Value + 1
'example: Range("C2") = 26
'myRange("C2").value (26) = 26 + 1
End If
Next oControl
End If
Next iCtr
as i usually do, i suspect this is coded way more difficult than it
needs to be.
any help or suggestions?
thank you!
susan
i'm in waaaay over my head. i THINK i understand this theory...... to
explain:
i have a userform w/a 3-page multipage.
each multipage has (approx.) 4 frames on it
each frame has 3-5 option buttons in it.
the purpose of the userform is to incrementally add "1" to each
evaluation question on the worksheet.
Question 1 (frame name is Q1)
5 (optionbutton name is Q1Opt5)
4 (optionbutton name is Q1Opt4)
3 (name is Q1Opt3)
Question 2 (frame name is Q2)
5 (name is Q2Opt5)
4 (name is Q2Opt4)
3 (name is Q2Opt3)
and so forth. the worksheet ranges correspond:
Set r1 = ws.Range("d8:j13")
Set r2 = ws.Range("d18:j23")
Set r3 = ws.Range("d28:j33")
so, i want to go thru each frame, find the option button that is
selected, find THAT # option button in the corresponding range, find
the correct row, and add 1 to the correct column in the correct row in
the correct range. i'm using iCtr as the numeral for each frame.
this is what i've got so far..............
Dim iCtr As Long
'this is how i can incrementally check each frame
For iCtr = 1 To 13
If TypeOf oControl Is msforms.Frame Then
oControl = "Frame" & iCtr
'now i need to see which option button = true within each frame...
For Each oControl In oControl
If oControl("Q" & iCtr & "Opt1").Value = True Then
sRange = "r" & iCtr
sCaption = oControl("Q" & iCtr & "Opt1").Caption
'the captions of each option button are 1, 2, 3, etc.
Set rFound = myRange.Find(What:=sCaption, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
MatchCase:=False)
If rFound Is Nothing Then
MsgBox "Caption not found in range"
End If
myRow = rFound.Row
'column i contains the numeric that needs incrementing
Set myRange = ws.Range("i" & myRow)
myRange.Value = myRange.Value + 1
'example: Range("C2") = 26
'myRange("C2").value (26) = 26 + 1
End If
Next oControl
End If
Next iCtr
as i usually do, i suspect this is coded way more difficult than it
needs to be.
any help or suggestions?
thank you!
susan