![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: May 2002
Posts: 25
|
Is there any VBA code to ignore a "Runtime error '13': Type mismatch" ERROR??
My VBA code is referencing a Dynamic Data Exchange link and my code gives this error because it takes a couple of seconds for the dde to fill the cell with data instead of the #REF! error. Thanks mcleve [ This Message was edited by: mcleve on 2002-05-20 06:20 ] |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Feb 2002
Location: Huntington Beach, CA USA
Posts: 327
|
Hi,
Try On Error Resume Next |
|
|
|
|
|
#3 |
|
New Member
Join Date: May 2002
Posts: 25
|
Thanks that stopped the error!
But it created a new problem. is there anyway to keep the #REF! out of the cell? |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Feb 2002
Location: Huntington Beach, CA USA
Posts: 327
|
The #Ref is an error message, so that tells me "On Error Resume Next" is not the answer,
Post the line of your code this is occuring at. It's looking for an absolute referencei.e Sheet1!$A$1 opposed to a realitive reference A1 Regards, James |
|
|
|
|
|
#5 |
|
New Member
Join Date: May 2002
Posts: 25
|
cell A2 has the DDE link and J4 is linked to A2 both these cells return #REF! when the workbook is first opened. I can hit debug in the error box then hit run in the VBA editor and its ok because by then cell A2 has the actual value of the dde link.
On Error Resume Next stops the error message box but not the error code #REF! in the cells. The code is pasted in below. I need to stop it from returning #REF! in the cells. Sub worksheet_calculate() If Range("J4") < 2 Then 'THIS IS THE LINE THAT THE ERROR IS ON' Range("F4") = dde End If dde = Range("J4") If Range("F4") > Range("J4") Then Range("f4").Insert Shift:=xlDown If Range("F5") > 0 Then Range("E4").Value = Format(Now, "DD-MMM-YY HH:MM:SS") If Range("F5") <> ("F5") Then Range("E4").Insert Shift:=xlDown End If End If End If End Sub [ This Message was edited by: mcleve on 2002-05-19 22:08 ] [ This Message was edited by: mcleve on 2002-05-19 22:13 ] [ This Message was edited by: mcleve on 2002-05-19 22:14 ] |
|
|
|
|
|
#6 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Hi
If you will place this as your first line of code is the above procedure, it may help you. If TypeName(Range("J4").Value) = "Error" Then Exit Sub Tom |
|
|
|
|
|
#7 |
|
New Member
Join Date: May 2002
Posts: 25
|
Tom,
You have done it again!! Thanks for all the help guys. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|