Form Overwriting data

Curben

Board Regular
Joined
Aug 18, 2011
Messages
65
This is part of a user form to add data to an existing spreadsheet. The problem i am having is the form will repeatedly overwrite the same line instead of moving onto the next.

Private Sub btnEnter1_Click()

Dim emptyRow As Long
Sheets("Bin Entry").Activate
emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1


If Trim(Me.TextBox3.Value) = "" Then
Me.TextBox3.SetFocus
MsgBox "Please enter a SKU number"
Exit Sub
End If
Cells(emptyRow, 1) = TextBox7.Value 'Vendor
Cells(emptyRow, 3) = TextBox2.Value 'Date
Cells(emptyRow, 4) = TextBox4.Value 'Order#
Cells(emptyRow, 5) = TextBox3.Value 'SKU
Cells(emptyRow, 6) = TextBox8.Value 'Vendor#
Cells(emptyRow, 7) = TextBox10.Value 'Description
Cells(emptyRow, 8) = TextBox5.Value 'Qty
Cells(emptyRow, 11) = Val(TextBox9.Text) * Val(TextBox5.Text) 'ExtCost
'clear the data
Unload Me
frmDataEntry1.Show
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
ok, now the problem is it will not search hidden rows. The idea is to keep all the rows hidden so to keep certain data from the user. (this is done via grouping).

when i tested it all rows were still shown. now that i tried running it with the group of rows hidden it overwrites row 2 repeatedly
 
Last edited:
Upvote 0
Does this fare any better?

Code:
emptyRow = Columns("A").Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row + 1
 
Upvote 0

Forum statistics

Threads
1,224,550
Messages
6,179,459
Members
452,915
Latest member
hannnahheileen

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