find next empty row and enter details.VBA code help excel 2003

  • Thread starter Thread starter Legacy 169354
  • Start date Start date
L

Legacy 169354

Guest
Hi everyone,
I managed to clown my way to this code to enter values from a form I made. It enters the values in the cells fine but I have some questions:

1) The worksheet starts at A4 but the code below starts it in A6. How can I change this.

2) Also, I need code to check if the line/row is empty before the form data is entered. If it is not empty then it needs to find the next empty row and print it there. This needs to happen for every time the submit button is pressed!

3) I also need code to check the previous entriy into the worksheet and see if it is identical. if it is a msgbox needs to come up advising before being entered onto a new line (and having the option to cancel the submit and return to the form).

Thanks!!!!!!!!!!

'write data to worksheet
RowCount = Worksheets("Data0").Range("A4").CurrentRegion.Rows.Count
With Worksheets("Data0").Range("A4")
.Offset(RowCount, 0).Value = Me.txt_refnum.Value
.Offset(RowCount, 1).Value = DateValue(Me.txt_date.Value)
.Offset(RowCount, 2).Value = Me.txt_time.Value
.Offset(RowCount, 3).Value = Me.txt_port.Value
.Offset(RowCount, 4).Value = Me.Combo_phase_flt.Value
.Offset(RowCount, 5).Value = Me.Combo_species.Value
.Offset(RowCount, 6).Value = Me.Combo_effect.Value
End With
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hi Guys, I just changed the cell reference to A1 instead of A4!

But is you know the answers to my other questions that would be excelent!
 
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,134
Members
452,890
Latest member
Nikhil Ramesh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top