Can you help? I am creating a form that will create an excel sheet with a specified number of inputs which are the rows and outputs which are the columns but I can not seem to figure out how to make the inputs count be a selection of column A and the amount of rows needed. I also need to do this with the columns but this is to be done via inputs from a form.
Top is device selection, middle is the inputs and third is the outputs. 
This is the code to use for the selection but how do I apply coordinates for x, y from this form?
Private Sub cmdbtnSetMatrix_Click()
Dim txtBox1 As String
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Test Matrix")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
'check for a Device Name, Inputs count and Outputs count
If Trim(Me.comboBoxMan.Value) = "" Then
Me.comboBoxMan.SetFocus
MsgBox "Please select a Manufacture"
Exit Sub
End If
If Trim(Me.comboBoxMan.Value) = "Select a Manufacture" Then
Me.comboBoxMan.SetFocus
MsgBox "You must select a manufacture to move on!"
Exit Sub
End If
'If Trim(Me.txtboxDeviceName.Value) = "" Then
' Me.txtboxDeviceName.SetFocus
'MsgBox "Please enter a Device name"
'Exit Sub
'End If
If Trim(Me.txtBoxInputs.Value) = "" Then
Me.txtBoxInputs.SetFocus
MsgBox "Please enter the amount of inputs the device has"
Exit Sub
End If
If Trim(Me.txtBoxOutputs.Value) = "" Then
Me.txtBoxOutputs.SetFocus
MsgBox "Please enter the amount of outputs the device has"
Exit Sub
End If
If Trim(Me.comboBoxMan.Value) = "Select a control signal type" Then
Me.comboBoxMan.SetFocus
MsgBox "You must select a control signal type before continuing"
Exit Sub
End If
'copy the data to the database
ws.Cells(iRow, 1).Value = Me.comboBoxMan.Value
'ws.Cells(iRow, 2).Value = Me.txtboxDeviceName.Value
ws.Cells(iRow, 3).Value = Me.txtBoxInputs.Value
ws.Cells(iRow, 4).Value = Me.txtBoxOutputs.Value
'ws.Cells(iRow, 5).Value = Me.ComboBox1.Value
'clear the data
'Me.txtboxDeviceName.Value = ""
Me.txtBoxInputs.Value = ""
Me.txtBoxOutputs.Value = ""
'Me.ComboBox1.ListIndex = 0
Me.comboBoxMan.ListIndex = 0
'Me.txtboxDeviceName.SetFocus
End Sub
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.