How to loop through table rows and then the columns?
I am new to VBA and what I am trying to do is to pull information into datasheet from user form, that enters 7 rows not 7 columns. Currently the code
What I am looking for is a loop (i think) that will repeat " cboEmployID,cboEmployID.List(lPart, 1),cboProgram" in columns A:C and move each set of cboLocation & DTPicker to a new row to populate in Columns D:E
I am new to VBA and what I am trying to do is to pull information into datasheet from user form, that enters 7 rows not 7 columns. Currently the code
Code:
'copy the data to the database
With ws
.Cells(lRow, 2).Value = Me.cboEmployID.Value
.Cells(lRow, 1).Value = Me.cboEmployID.List(lPart, 1)
.Cells(lRow, 5).Value = Me.cboLocSun.Value
.Cells(lRow, 7).Value = Me.cboLocMon.Value
.Cells(lRow, 9).Value = Me.cboLocTue.Value
.Cells(lRow, 11).Value = Me.cboLocWen.Value
.Cells(lRow, 13).Value = Me.cboLocThu.Value
.Cells(lRow, 15).Value = Me.cboLocFri.Value
.Cells(lRow, 17).Value = Me.cboLocSat.Value
.Cells(lRow, 4).Value = Me.DTPickerSun.Value
.Cells(lRow, 6).Value = Me.DTPickerMon.Value
.Cells(lRow, 8).Value = Me.DTPickerTue.Value
.Cells(lRow, 10).Value = Me.DTPickerWen.Value
.Cells(lRow, 12).Value = Me.DTPickerThu.Value
.Cells(lRow, 14).Value = Me.DTPickerFri.Value
.Cells(lRow, 16).Value = Me.DTPickerSat.Value
.Cells(lRow, 3).Value = Me.cboProgram.Value