Double loop with dialog box

eyong123

New Member
Joined
Aug 1, 2011
Messages
34
Hi I am new to macros. i intend towrite a code that does the following action.

It selects cells in column B which has same value as input in dialogbox (line no.)
the line number occurs three or more times in succession and then changes to the next line number. so I want the next loop now to be fill in the dialog box info from column C if it is empty and the it loops until there is a change in line number in column B.

This is the code I have used but unfortunately it fills out all the rows of the particular line no. I want it to fill just one at a time and stop.

Please can you help !

Private Sub CmdOK_Click()


ActiveWorkbook.Sheets("Daily report Fab 1&2").Activate

If cboLijn.Value = "L01" Then
Range("C3").Select

For i = 3 To 7
If Range("C" & i).Value = False Then
Range("C" & i).Value = txtReferentie.Value
Range("D" & i).Value = cboChocolateType.Value
Range("E" & i).Value = cboUnscheduledHours.Value

End If


Next i
End If





End Sub
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,224,522
Messages
6,179,299
Members
452,904
Latest member
CodeMasterX

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