I am running a macro in excel and encouter an erro message NAMED ARGUMENT NOT FOUND Please help Me

gmdavid

New Member
Joined
Jul 24, 2017
Messages
1
The are written Below:rofl:


Private Sub cmdadd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("sheet1")
'first find empty Row in the Sheet
iRow = ws.Cells.Find(what:="*", SearchOrder:=xlRows, SearchDirection:=xlPrevious, SearchOrder:=xlValues).iRow + 1

'Check for a Name number
If Trim(Me.TextBox_ItemName.Value) = "" Then
Me.TextBox_ItemName.SetFocus
MsgBox "Please complete The Form"
Exit Sub
End If

'Copy the Data in the Database
ws.Cells(iRow, 1).Value = Me.TextBox_ItemName.Value
ws.Cells(iRow, 2).Value = Me.TextBox_DateIn.Value
ws.Cells(iRow, 3).Value = Me.TextBox_QtyIn.Value
ws.Cells(iRow, 4).Value = Me.TextBox_DateOut.Value
ws.Cells(iRow, 5).Value = Me.TextBox_QtyOut.Value
MsgBox "Data Added", vbOKOnly + vbInformation, "Data Added"

'Clear the Data
Me.TextBox_ItemName.Value = ""
Me.TextBox_DateIn.Value = ""
Me.TextBox_QtyIn.Value = ""
Me.TextBox_DateOut.Value = ""
Me.TextBox_QtyOut.Value = ""
Me.TextBox_ItemName.SetFocus
End Sub

Private Sub cmdclose_Click()
Unload Me
End Sub


Private Sub UserForm_Click()

End Sub
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hi & welcome to the board
It would help if you told us where the error occurred, but looking at your code i think that this
Code:
iRow = ws.Cells.Find(what:="*", SearchOrder:=[COLOR=#ff0000]xlRows[/COLOR], SearchDirection:=xlPrevious, [COLOR=#0000ff]SearchOrder[/COLOR]:=xlValues).iRow + 1
should be
Code:
iRow = ws.Cells.Find(what:="*", SearchOrder:=[COLOR=#ff0000]xlbyRows[/COLOR], SearchDirection:=xlPrevious, [COLOR=#0000ff]LookIn[/COLOR]:=xlValues).iRow + 1
 
Upvote 0
Noticed another error
Code:
iRow = ws.Cells.Find(what:="*", SearchOrder:=xlbyRows, SearchDirection:=xlPrevious, LookIn:=xlValues).[COLOR=#ff0000]iRow [/COLOR]+ 1
should be
Code:
iRow = ws.Cells.Find(what:="*", SearchOrder:=xlbyRows, SearchDirection:=xlPrevious, LookIn:=xlValues).[COLOR=#ff0000]Row [/COLOR]+ 1
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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