+ Reply to Thread
Results 1 to 8 of 8

VBA Vlookup function returns wrong values

Hybrid View

  1. #1
    Registered User
    Join Date
    05-20-2015
    Location
    HK
    MS-Off Ver
    2010
    Posts
    9

    Re: VBA Vlookup function returns wrong values

    Hi michson! I have tried and run the code. It indeed is working with the importation of numbers. However, the value imported is still in text format even after the alternation of the code from this:
     With range("K4:K43")
            .Cells.Copy
            .Cells.PasteSpecial xlPasteValues
            .Cells(1).Select
        End With
        Application.CutCopyMode = False
    to this:
    With targetSheet.range("K4:K43")
            .Cells.Copy
            .Cells.PasteSpecial xlPasteValuesAndNumberFormats
            .Cells(1).Select
        End With
        Application.CutCopyMode = False
    and so the column next to it cannot carry out its designated functions as it only recognizes numeric value. I have tried using "range value" to fix the problem but it is still showing up as formula only in the cell.

    Also, I have tried using the following codes to remove the #N/A in the cells but none of them worked.
    Cells.SpecialCells(xlCellTypeFormulas, xlErrors).Clear
    Cells.Replace "#N/A", "clear", xlWhole
    This one worked a few times and then suddenly stopped working:

    Cells.SpecialCells(xlCellTypeFormulas, xlErrors).Clearcontent
    Updates: I have fixed the numeric value problem by multiplying the formula with 1 so that the text format is forced into becoming numeric values in cells. Now only remains the #N/A problem.

    Would you please give me some pointers to that? Thank you very much.
    Last edited by alicelia; 05-29-2015 at 03:01 AM.

+ 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. [SOLVED] My Vlookup returns the wrong info
    By dstrdOne in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-16-2013, 01:42 PM
  2. VLookup returns N/A or wrong value
    By vindieselgal in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-08-2011, 07:20 AM
  3. VLOOKUP returns wrong values
    By surfol in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-26-2011, 03:26 PM
  4. Row() function returns wrong row and more..
    By Kim in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-10-2006, 09:14 PM
  5. [SOLVED] My Datedif function only returns 0's in the cell what's wrong?
    By Tom in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-13-2006, 02:45 PM

Tags for this Thread

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