The following code I'm using to insert users data.
If textbox1.value > 0 and Textbox1.value < 86 then
ActiveSheet.cells(TextBox1.value + 8, 4).value = Textbox4.text
'check if cell has data already
If ActiveSheet.Cells(TextBox1.Value + 8, 4) <> "" Then
'if cell not blank insert new row
ActiveSheet.Cells(TextBox1.Value + 9).Select
With Selection.EntireRow.Insert
'now insert data into new row column 4
ActiveSheet.Cells(TextBox1.Value + 9, 4).Value = _
TextBox4.Text
End With
Else
ActiveSheet.Cells(TextBox1.Value + 8, 4).Value = _
TextBox4.Text
End If
it takes the user input in textbox1 and adds 8. So if the user input 1 the code would add 8 to get row 9, column 4 and then insert textbox4.text but if row 9, 4 is not blank then it will add 9 to get to the row below which would then be 10 and insert a new row then insert the data into the new row which would be 10, 4.
I am getting it to insert new rows but not at the point I need them.
any ideas?
If textbox1.value > 0 and Textbox1.value < 86 then
ActiveSheet.cells(TextBox1.value + 8, 4).value = Textbox4.text
'check if cell has data already
If ActiveSheet.Cells(TextBox1.Value + 8, 4) <> "" Then
'if cell not blank insert new row
ActiveSheet.Cells(TextBox1.Value + 9).Select
With Selection.EntireRow.Insert
'now insert data into new row column 4
ActiveSheet.Cells(TextBox1.Value + 9, 4).Value = _
TextBox4.Text
End With
Else
ActiveSheet.Cells(TextBox1.Value + 8, 4).Value = _
TextBox4.Text
End If
it takes the user input in textbox1 and adds 8. So if the user input 1 the code would add 8 to get row 9, column 4 and then insert textbox4.text but if row 9, 4 is not blank then it will add 9 to get to the row below which would then be 10 and insert a new row then insert the data into the new row which would be 10, 4.
I am getting it to insert new rows but not at the point I need them.
any ideas?