?
Solved

Application defined error

Posted on 2011-03-15
2
Medium Priority
?
194 Views
Last Modified: 2012-06-27
Hi,

the attached piece of code is failing on the line

  .Range("J2").Formula = "=IF(ISERR(I3-F2),"""",I3-F2))"

Its saying

Application defined or Object defined error

This is in the VB editor, can anyone see what is wrong with the forumula?

Thanks
Seamus
Sub FillFormula()

Dim r As Long

With Sheets("Pay Rec Data")
    r = .Range("A" & Rows.Count).End(xlUp).Row
    .Range("D2").Formula = "=IF(B2=""entered"",""Yes"",IF(B2="""","""",""No""))"
    .Range("E2").Formula = "=IF(D2=""Yes"",MID(C2,4,10),"""")"
    .Range("F2").Formula = "=IF(D2=""Yes"",RIGHT(C2,8),"""")"
    .Range("G2").Formula = "=IF(B2=""left at"",""Yes"",IF(B2="""","""",""No""))"
    .Range("H2").Formula = "=IF(D2=""No"",C2,"""")"
    .Range("I2").Formula = "=IF(D2=""No"",C2,"""")"
    .Range("J2").Formula = "=IF(ISERR(I3-F2),"""",I3-F2))"
    .Range("K2").Formula = "=J2"
    .Range("L2").Formula = "=IF(A2=""travseam"",""Seamus Travers"","""")"
    
    .Range("D2:L2").Copy .Range("D2:L" & r)
End With

End Sub

Open in new window

0
Comment
Question by:Seamus2626
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 39

Accepted Solution

by:
nutsch earned 2000 total points
ID: 35139624
one parenthesis too many

  .Range("J2").Formula = "=IF(ISERR(I3-F2),"""",I3-F2)"

T
0
 

Author Closing Comment

by:Seamus2626
ID: 35139912
Thanks Thomas!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This article describes a serious pitfall that can happen when deleting shapes using VBA.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question