Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Receiving 'Error 1004' with VBA program
I am writing a VBA that allows the user to scan or enter an item on
lines in a spreadsheet. If the UPC is not valid, it triggers a Userform that let's the user to input a description to find the item in question instead of a UPC. The problem I am having is in the programming linking the Userform description to the find formula. If there is a match, the program continues fine; however, if there is no match, the program issues an 'Error 1004' and stalls at the following line: If IsError(Sheet6.Range("L2").Formula = Application.WorksheetFunction.IsNumber(Application .WorksheetFunction.Find(frmMatchDescriptions.txtEn terDescription, Sheet6.Range("L2").Offset(0, -9).Value))) Then Sheet6.Range("L2").Value = False Else Sheet6.Range("L2").Formula = Application.WorksheetFunction.IsNumber(Application .WorksheetFunction.Find(frmMatchDescriptions.txtEn terDescription, Sheet6.Range("L2").Offset(0, -9).Value)) End If Please tell me what is wrong and how I can correct this? Thank you, Shawn |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Receiving 'Error 1004' with VBA program
I think you may be setting an item to a formula that can't be asigned to the
formula. You need to break your code up into small pieces Sub test() Set c = Application.WorksheetFunction.Find(frmMatchDescrip tions.txtEnterDescription, _ Sheet6.Range("L2").Offset(0, -9).Value) If Not c Is Nothing Then If Application.WorksheetFunction.IsNumber(c) Then Sheet6.Range("L2").Formula = c Else Sheet6.Range("L2").Value = False End If End If End Sub " wrote: I am writing a VBA that allows the user to scan or enter an item on lines in a spreadsheet. If the UPC is not valid, it triggers a Userform that let's the user to input a description to find the item in question instead of a UPC. The problem I am having is in the programming linking the Userform description to the find formula. If there is a match, the program continues fine; however, if there is no match, the program issues an 'Error 1004' and stalls at the following line: If IsError(Sheet6.Range("L2").Formula = Application.WorksheetFunction.IsNumber(Application .WorksheetFunction.Find(frmMatchDescriptions.txtEn terDescription, Sheet6.Range("L2").Offset(0, -9).Value))) Then Sheet6.Range("L2").Value = False Else Sheet6.Range("L2").Formula = Application.WorksheetFunction.IsNumber(Application .WorksheetFunction.Find(frmMatchDescriptions.txtEn terDescription, Sheet6.Range("L2").Offset(0, -9).Value)) End If Please tell me what is wrong and how I can correct this? Thank you, Shawn |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Receiving #VALUE! error for my average formula | Excel Discussion (Misc queries) | |||
Receiving error 1004 - Method 'Rang' of object '_Global' failed | Excel Programming | |||
Receiving font error | Excel Discussion (Misc queries) | |||
Renamed tab .xls3 receiving a error but can't fix | Excel Worksheet Functions | |||
Trying to open a file and receiving this error. | Excel Discussion (Misc queries) |