LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Insert row gives run-time error 13 message

Me again....

I'm using the below to insert a formula into column E if the corresponding
column D value is changed.... so far so good.

However, if the user inserts a line it gives a "Run-time error 13: type
mismatch" and highlights the "If Len(Target....." section of the macro...

Any ideas how to fix it?



Sub Worksheet_Change(ByVal Target As Range)

Dim r As Long

If Not Intersect(Range(Target.Address), Columns("D:D")) _
Is Nothing And Target.Row 5 Then

r = Target.Row

If Len(Target.Value) 0 Then

Cells(r, "E").FormulaR1C1 =
"=IF(IF(RC[-1]="""",RC[-2],RC[-1])=0,"""",IF(RC[-1]="""",RC[-2],RC[-1]))"

End If
End If

End Sub
 
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
cant insert column get error message sheppey Excel Worksheet Functions 2 May 6th 08 02:13 PM
Error message in macro to insert new row? Wuddus Excel Discussion (Misc queries) 2 September 5th 06 03:31 PM
replace VBA run-time error message with custom message BEEJAY Excel Programming 13 July 14th 06 03:59 PM
Getting error message when I try to insert rows. jkc1 Excel Discussion (Misc queries) 1 April 13th 06 07:19 PM
Error message when trying to insert a column Kelly Excel Discussion (Misc queries) 8 September 12th 05 08:59 PM


All times are GMT +1. The time now is 06:48 PM.

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

About Us

"It's about Microsoft Excel"