Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
1004 error
I have the following piece of code. The Msgbox prints correctly, whereas the
very next line gives the error: 1004: Application defined or object-defined error Private Sub Worksheet_Change(ByVal Target As Range) myRow = Target.Row MsgBox Cells(myRow, "E") ' prints the message correctly. Cells(myRow, "E") = "=$E$3" ' throws the error Anybody has any idea why I am getting this error. -- - Mangesh ------------------------------------------ Office 2003 & Windows XP |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
1004 error
forgot to mention something. The cell I am changing has a list validation.
If I change it manually, no error, whereas if I change it by clicking on the drop-down list (data validation), I get the error. Mangesh "Mangesh Yadav" wrote in message ... I have the following piece of code. The Msgbox prints correctly, whereas the very next line gives the error: 1004: Application defined or object-defined error Private Sub Worksheet_Change(ByVal Target As Range) myRow = Target.Row MsgBox Cells(myRow, "E") ' prints the message correctly. Cells(myRow, "E") = "=$E$3" ' throws the error Anybody has any idea why I am getting this error. -- - Mangesh ------------------------------------------ Office 2003 & Windows XP |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
1004 error
Mangesh,
I tried your code - it did not give any error. It kept redisplaying the message box since you do not turn off the Application.EnableEvents property before making a change. Also just some comments on your code .. it is preferable to not use Cells - as that is an unqualified reference and has given me some problems in the past. With ActiveSheet (or a specific sheet) .Cells(....) end with is preferable. Alok "Mangesh Yadav" wrote: forgot to mention something. The cell I am changing has a list validation. If I change it manually, no error, whereas if I change it by clicking on the drop-down list (data validation), I get the error. Mangesh "Mangesh Yadav" wrote in message ... I have the following piece of code. The Msgbox prints correctly, whereas the very next line gives the error: 1004: Application defined or object-defined error Private Sub Worksheet_Change(ByVal Target As Range) myRow = Target.Row MsgBox Cells(myRow, "E") ' prints the message correctly. Cells(myRow, "E") = "=$E$3" ' throws the error Anybody has any idea why I am getting this error. -- - Mangesh ------------------------------------------ Office 2003 & Windows XP |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
1004 error
Hi Alok,
Thanks for the response. Actually I am close to isolating the error. I have one UDF which if not used in a particular cell, then the error does not come. Also, the error comes only when I choose an item by selecting it with the mouse, and no error when entering manually in the cell. Mangesh "Alok" wrote in message ... Mangesh, I tried your code - it did not give any error. It kept redisplaying the message box since you do not turn off the Application.EnableEvents property before making a change. Also just some comments on your code .. it is preferable to not use Cells - as that is an unqualified reference and has given me some problems in the past. With ActiveSheet (or a specific sheet) .Cells(....) end with is preferable. Alok "Mangesh Yadav" wrote: forgot to mention something. The cell I am changing has a list validation. If I change it manually, no error, whereas if I change it by clicking on the drop-down list (data validation), I get the error. Mangesh "Mangesh Yadav" wrote in message ... I have the following piece of code. The Msgbox prints correctly, whereas the very next line gives the error: 1004: Application defined or object-defined error Private Sub Worksheet_Change(ByVal Target As Range) myRow = Target.Row MsgBox Cells(myRow, "E") ' prints the message correctly. Cells(myRow, "E") = "=$E$3" ' throws the error Anybody has any idea why I am getting this error. -- - Mangesh ------------------------------------------ Office 2003 & Windows XP |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Run time error 1004, General ODBC error | New Users to Excel | |||
run-time error '1004': Application-defined or object-deifined error | Excel Programming | |||
Excel 2003 Macro Error - Runtime error 1004 | Excel Discussion (Misc queries) | |||
Run time error 1004 General ODCB Error | Excel Programming | |||
Application Run Time Error 1004 and Stack Error | Excel Programming |