Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Receiving #VALUE! error for my average formula JAbels001 Excel Discussion (Misc queries) 2 September 25th 08 08:22 PM
Receiving error 1004 - Method 'Rang' of object '_Global' failed Tim Excel Programming 2 August 13th 07 02:38 PM
Receiving font error depwife Excel Discussion (Misc queries) 2 July 20th 07 02:34 PM
Renamed tab .xls3 receiving a error but can't fix TB Excel Worksheet Functions 2 July 31st 06 04:38 AM
Trying to open a file and receiving this error. John J. Excel Discussion (Misc queries) 1 March 4th 05 07:04 PM


All times are GMT +1. The time now is 11:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"