looping

Status
Not open for further replies.

Jefferson2512

Board Regular
Joined
Sep 16, 2019
Messages
53
can someone help me to loop this ?

Code:
Dim wks As Worksheet
Dim addnew As Range
Dim addup(15) As Double
    Set wks = Sheet9
    Set addnew = wks.Range("AG3").Offset(0, 0)
        If ecYes.Value = True Then
            addnew.Offset(0, 1).Value = ecYes.Caption
            ElseIf ecNo.Value = True Then
            addnew.Offset(0, 1).Value = ecNo.Caption
            ElseIf ecNa.Value = True Then
            addnew.Offset(0, 1).Value = ecNa.Caption
        End If
        If ecYes1.Value = True Then
            addnew.Offset(0, 2).Value = ecYes1.Caption
            ElseIf ecNo1.Value = True Then
            addnew.Offset(0, 2).Value = ecNo1.Caption
            ElseIf ecNa1.Value = True Then
            addnew.Offset(0, 2).Value = ecNa1.Caption
        End If
        If ecYes2.Value = True Then
            addnew.Offset(0, 3).Value = ecYes2.Caption
            ElseIf ecNo2.Value = True Then
            addnew.Offset(0, 3).Value = ecNo2.Caption
            ElseIf ecNa2.Value = True Then
            addnew.Offset(0, 3).Value = ecNa2.Caption
        End If
        If ecYes3.Value = True Then
            addnew.Offset(0, 4).Value = ecYes3.Caption
            ElseIf ecNo3.Value = True Then
            addnew.Offset(0, 4).Value = ecNo3.Caption
            ElseIf ecNa3.Value = True Then
            addnew.Offset(0, 4).Value = ecNa3.Caption
        End If
        If ecYes4.Value = True Then
            addnew.Offset(0, 5).Value = ecYes4.Caption
            ElseIf ecNo4.Value = True Then
            addnew.Offset(0, 5).Value = ecNo4.Caption
            ElseIf ecNa4.Value = True Then
            addnew.Offset(0, 5).Value = ecNa4.Caption
        End If
        If ecYes5.Value = True Then
            addnew.Offset(0, 6).Value = ecYes5.Caption
            ElseIf ecNo5.Value = True Then
            addnew.Offset(0, 6).Value = ecNo5.Caption
            ElseIf ecNa5.Value = True Then
            addnew.Offset(0, 6).Value = ecNa5.Caption
        End If
        If ecYes6.Value = True Then
            addnew.Offset(0, 7).Value = ecYes6.Caption
            ElseIf ecNo6.Value = True Then
            addnew.Offset(0, 7).Value = ecNo6.Caption
            ElseIf ecNa6.Value = True Then
            addnew.Offset(0, 7).Value = ecNa6.Caption
        End If
        If ecYes7.Value = True Then
            addnew.Offset(0, 8).Value = ecYes7.Caption
            ElseIf ecNo7.Value = True Then
            addnew.Offset(0, 8).Value = ecNo7.Caption
            ElseIf ecNa7.Value = True Then
            addnew.Offset(0, 8).Value = ecNa7.Caption
        End If
        If ecYes8.Value = True Then
            addnew.Offset(0, 9).Value = ecYes8.Caption
            ElseIf ecNo8.Value = True Then
            addnew.Offset(0, 9).Value = ecNo8.Caption
            ElseIf ecNa8.Value = True Then
            addnew.Offset(0, 9).Value = ecNa8.Caption
        End If
        If ecYes9.Value = True Then
            addnew.Offset(0, 10).Value = ecYes9.Caption
            ElseIf ecNo9.Value = True Then
            addnew.Offset(0, 10).Value = ecNo9.Caption
            ElseIf ecNa9.Value = True Then
            addnew.Offset(0, 10).Value = ecNa9.Caption
        End If
        If ecYes10.Value = True Then
            addnew.Offset(0, 11).Value = ecYes10.Caption
            ElseIf ecNo10.Value = True Then
            addnew.Offset(0, 11).Value = ecNo10.Caption
            ElseIf ecNa10.Value = True Then
            addnew.Offset(0, 11).Value = ecNa10.Caption
        End If
        If ecYes11.Value = True Then
            addnew.Offset(0, 12).Value = ecYes11.Caption
            ElseIf ecNo11.Value = True Then
            addnew.Offset(0, 12).Value = ecNo11.Caption
            ElseIf ecNa11.Value = True Then
            addnew.Offset(0, 12).Value = ecNa11.Caption
        End If


        If ecYes.Value = True Then
            addup(0) = 100
            ElseIf ecNo.Value = True Then
            addup(0) = 0
            ElseIf ecNa.Value = True Then
            addup(0) = 100
        End If
        If ecYes1.Value = True Then
            addup(1) = 100
            ElseIf ecNo1.Value = True Then
            addup(1) = 0
            ElseIf ecNa1.Value = True Then
            addup(1) = 100
        End If
        If ecYes2.Value = True Then
            addup(2) = 100
            ElseIf ecNo2.Value = True Then
            addup(2) = 0
            ElseIf ecNa2.Value = True Then
            addup(2) = 100
        End If
        If ecYes3.Value = True Then
            addup(3) = 100
            ElseIf ecNo3.Value = True Then
            addup(3) = 0
            ElseIf ecNa3.Value = True Then
            addup(3) = 100
        End If
        If ecYes4.Value = True Then
            addup(4) = 100
            ElseIf ecNo4.Value = True Then
            addup(4) = 0
            ElseIf ecNa4.Value = True Then
            addup(4) = 100
        End If
        If ecYes5.Value = True Then
            addup(5) = 100
            ElseIf ecNo5.Value = True Then
            addup(5) = 0
            ElseIf ecNa5.Value = True Then
            addup(5) = 100
        End If
        If ecYes6.Value = True Then
            addup(6) = 100
            ElseIf ecNo6.Value = True Then
            addup(6) = 0
            ElseIf ecNa6.Value = True Then
            addup(6) = 100
        End If
        If ecYes7.Value = True Then
            addup(7) = 100
            ElseIf ecNo7.Value = True Then
            addup(7) = 0
            ElseIf ecNa7.Value = True Then
            addup(7) = 100
        End If
        If ecYes8.Value = True Then
            addup(8) = 100
            ElseIf ecNo8.Value = True Then
            addup(8) = 0
            ElseIf ecNa8.Value = True Then
            addup(8) = 100
        End If
        If ecYes9.Value = True Then
            addup(9) = 100
            ElseIf ecNo9.Value = True Then
            addup(9) = 0
            ElseIf ecNa9.Value = True Then
            addup(9) = 100
        End If
        If ecYes10.Value = True Then
            addup(10) = 100
            ElseIf ecNo10.Value = True Then
            addup(10) = 0
            ElseIf ecNa10.Value = True Then
            addup(10) = 100
        End If
        If ecYes11.Value = True Then
            addup(11) = 100
            ElseIf ecNo11.Value = True Then
            addup(11) = 0
            ElseIf ecNa11.Value = True Then
            addup(11) = 100
        End If
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
What are the ecYes, ecNo, ecNa, etc. controls?
Where are these controls embedded? In a worksheet or in UserForm?

Artik
 
Upvote 0
This appears to be a duplicate of the last part of this post.

Please do not post the same question multiple times. Questions of a duplicate nature will be locked or deleted, per #12 of the Forum Rules and points 6 & 7 of the Forum Use Guidelines.

Any bumps, clarifications, or follow-ups should be posted to the linked thread.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,223,886
Messages
6,175,195
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top