Hello, I am very VBA experience deficient and I've tried searching for some help but am stuck.
I'm making a user form, where there are ComboBoxes 1-10 (cmbProduct1, etc.) and TextBoxes 1-10 (txtProduct1Qty,etc.)
The user fills out the form and the quantities are stored in a "database sheet" organized by products as column headers. There are 40 Products, and 10 entrys on the form. So I need the 10 entrys to find their way to the right columns.
I need help matching the .Cells(RowIndex, ColumnIndex) based on the option selected in the combobox. I want to use a Header name, instead of a number here:
Code
Sub SubmitInventoryLogger()
Dim sh As Worksheet
Dim iRow As Long
Set sh = ThisWorkbook.Sheets("InventoryLogger")
iRow = [Counta(InventoryLogger!A:A)] + 1
With sh
.Cells(iRow, 1) = iRow - 1
.Cells(iRow, HELP HERE) = frmInventoryLogger.txtProduct1Qty
.Cells(iRow, HELP HERE) = frmInventoryLogger.txtProduct2Qty
.Cells(iRow, HELP HERE) = frmInventoryLogger.txtProduct3Qty
' etc... for up to 10 times. Sometimes they will be blank
.Cells(iRow, 3) = [Text(Now(), "DD-MM-YYYY HH:MM:SS")] ' this is the submit date time
End With
End Sub
Display More