+ Reply to Thread
Results 1 to 4 of 4

Vlookup error

  1. #1
    Registered User
    Join Date
    03-26-2007
    Posts
    63

    Vlookup error

    Hi,

    I am trying to put a VLookup formula using VBA.

    The code is as follows:

    Sub testingV()
    Dim ws9 As Worksheet
    Dim rng9 As Range

    Set ws9 = Sheets("Sheet5")
    Set rng9 = ws9.Range("C2", ws9.Range("C" & ws9.Rows.Count).End(xlUp))

    rng9.Offset(, 7).Formula = "=IF(ISNA(VLOOKUP(A2,[Theirs.xls]PAYABLES!$A$2:$C$500,3,FALSE)),"", VLOOKUP(A2,[Theirs.xls]PAYABLES!$A$2:$C$500,3,FALSE))"

    With rng9.Offset(, 9)
    .Formula = "=IF(I1),1,""x"")"
    .SpecialCells(xlCellTypeFormulas, 2).EntireRow.Select
    .SpecialCells(xlCellTypeFormulas, 2).EntireRow.Delete
    End With
    rng9.Offset(, 7).Resize(, 4).ClearContents
    End Sub


    However, when i am executing the same i am getting an error message at line:

    rng9.Offset(, 7).Formula = "=IF(ISNA(VLOOKUP(A2,[Theirs.xls]PAYABLES!$A$2:$C$500,3,FALSE)),"", VLOOKUP(A2,[Theirs.xls]PAYABLES!$A$2:$C$500,3,FALSE))"

    The error message reads :
    "Run Time Error 1004"
    "Application defined or Object defined error"

    Someone please guide me where m i doing wrong.

    Thanks

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,202
    Please edit your post by adding code tags.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    03-26-2007
    Posts
    63
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    03-26-2007
    Posts
    63
    someone please help ....

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Vlookup using two columns-needs to match the first two column
    By pduubb in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-01-2008, 01:21 PM
  2. Vlookup Ref error
    By jessa_lee in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-29-2008, 03:21 PM
  3. Vlookup Error
    By jat82nd in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-25-2007, 06:25 PM
  4. Data type error when using VLOOKUP
    By favoritepsalm1 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-13-2007, 10:02 AM
  5. Vlookup error
    By svincent in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-09-2006, 08:29 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1