Hello all, Brand new user and new to Excel Coding. I am working on a userform that asks for specific inputs. Depending on what those are, we could have the response to the Questions, we could have the need for between, 3 to 6 more Fields for entry.
Example, if I state in my user form I want a file server, I will need to add 5 extra drives and configs.
If I state in my user form I want a app server, I will only need to add 2 extra drives to the configs.
So my question is.
If I want to dynamically add the data back to the work sheet if there is a drive that is selected, how do I select the next free column?
I currently use static placement with my add button, here is the code I am using.
The next values would be txtdrive1,2,3,4,5 etc, but if nothing used for Drive 3,4,5 I want my next cell to populate next to the drive2 column.
Hope this is making sense and appreciate any direction you can point me.
Private Sub cmdaddserver_Click()
Range("A1").Select
'if all the above are false (OK) then carry on.
'check to see the next available blank row start at cell A2...
Do Until ActiveCell.Value = Empty
ActiveCell.Offset(1, 0).Select 'move down 1 row
Loop
'Populate the new data values into the 'Data' worksheet.
ActiveCell.Value = i 'Next ID number
ActiveCell.Offset(0, 1).Value = Me.ComboBox1.Value
ActiveCell.Offset(0, 7).Value = Me.ComboBox2.Value
ActiveCell.Offset(0, 0).Value = Me.txtservername.Value
ActiveCell.Offset(0, 2).Value = Me.ComboBox3.Value
ActiveCell.Offset(0, 3).Value = Me.txtsockets.Value
ActiveCell.Offset(0, 4).Value = Me.txtcores.Value
ActiveCell.Offset(0, 5).Value = Me.txtmemory.Value
ActiveCell.Offset(0, 6).Value = Me.txtnetwork.Value
'Clear the Data
Me.ComboBox1.Value = ""
Me.ComboBox2.Value = ""
Me.txtservername.Value = ""
Me.ComboBox3.Value = ""
Me.txtsockets.Value = ""
Me.txtcores.Value = ""
Me.txtmemory = ""
Me.txtnetwork = ""
Example, if I state in my user form I want a file server, I will need to add 5 extra drives and configs.
If I state in my user form I want a app server, I will only need to add 2 extra drives to the configs.
So my question is.
If I want to dynamically add the data back to the work sheet if there is a drive that is selected, how do I select the next free column?
I currently use static placement with my add button, here is the code I am using.
The next values would be txtdrive1,2,3,4,5 etc, but if nothing used for Drive 3,4,5 I want my next cell to populate next to the drive2 column.
Hope this is making sense and appreciate any direction you can point me.
Private Sub cmdaddserver_Click()
Range("A1").Select
'if all the above are false (OK) then carry on.
'check to see the next available blank row start at cell A2...
Do Until ActiveCell.Value = Empty
ActiveCell.Offset(1, 0).Select 'move down 1 row
Loop
'Populate the new data values into the 'Data' worksheet.
ActiveCell.Value = i 'Next ID number
ActiveCell.Offset(0, 1).Value = Me.ComboBox1.Value
ActiveCell.Offset(0, 7).Value = Me.ComboBox2.Value
ActiveCell.Offset(0, 0).Value = Me.txtservername.Value
ActiveCell.Offset(0, 2).Value = Me.ComboBox3.Value
ActiveCell.Offset(0, 3).Value = Me.txtsockets.Value
ActiveCell.Offset(0, 4).Value = Me.txtcores.Value
ActiveCell.Offset(0, 5).Value = Me.txtmemory.Value
ActiveCell.Offset(0, 6).Value = Me.txtnetwork.Value
'Clear the Data
Me.ComboBox1.Value = ""
Me.ComboBox2.Value = ""
Me.txtservername.Value = ""
Me.ComboBox3.Value = ""
Me.txtsockets.Value = ""
Me.txtcores.Value = ""
Me.txtmemory = ""
Me.txtnetwork = ""