I have a script that takes textbox entries from a vbaform and finds the first blank row and places the txtbox value in the cell.
What I need to do it place all form values into the same row as the first blank column.
Here is a visual example of what I need database to do.
column-> A | B | C |
row 1 x x x
row 2 x x
row 3 x x x
Currently my code would place row 3 B column x into row 2, I need to fix this. Here is an example of the code format I am using.
<CODE>
Dim longpos As String
longpos = txt_transcost.Text
'column A
'find first blank longpos
Let counter = 3
Set curcell = Worksheets("database").Cells(counter, 3)
Do Until curcell.Value = ""
counter = counter + 1
Set curcell = Worksheets("database").Cells(counter, 3)
Loop
Set curcell = Worksheets("database").Cells(counter, 3)
'post data
Worksheets("database").Cells(counter, 3).Value = UCase(longpos)
'Column B
'find first blank variable1
Let counter = 3
Set curcell = Worksheets("database").Cells(counter, 4)
Do Until curcell.Value = ""
counter = counter + 1
Set curcell = Worksheets("database").Cells(counter, 4)
Loop
Set curcell = Worksheets("database").Cells(counter, 4)
'post data
Worksheets("database").Cells(counter, 4).Value = variable1
'Column C (not shown)
</CODE>
Any ideas how I can fix this? Thanks for your help
What I need to do it place all form values into the same row as the first blank column.
Here is a visual example of what I need database to do.
column-> A | B | C |
row 1 x x x
row 2 x x
row 3 x x x
Currently my code would place row 3 B column x into row 2, I need to fix this. Here is an example of the code format I am using.
<CODE>
Dim longpos As String
longpos = txt_transcost.Text
'column A
'find first blank longpos
Let counter = 3
Set curcell = Worksheets("database").Cells(counter, 3)
Do Until curcell.Value = ""
counter = counter + 1
Set curcell = Worksheets("database").Cells(counter, 3)
Loop
Set curcell = Worksheets("database").Cells(counter, 3)
'post data
Worksheets("database").Cells(counter, 3).Value = UCase(longpos)
'Column B
'find first blank variable1
Let counter = 3
Set curcell = Worksheets("database").Cells(counter, 4)
Do Until curcell.Value = ""
counter = counter + 1
Set curcell = Worksheets("database").Cells(counter, 4)
Loop
Set curcell = Worksheets("database").Cells(counter, 4)
'post data
Worksheets("database").Cells(counter, 4).Value = variable1
'Column C (not shown)
</CODE>
Any ideas how I can fix this? Thanks for your help