+ Reply to Thread
Results 1 to 6 of 6

VBA to copy down Vlookup VBA code in Column till last available data

  1. #1
    Registered User
    Join Date
    09-10-2014
    Location
    India
    MS-Off Ver
    10
    Posts
    44

    VBA to copy down Vlookup VBA code in Column till last available data

    Hello,

    I have worked on the Vlookup VBA code. Its working fine.

    BUT, I want this code to get applied for the whole Row till last available data.

    I want below code to be get applied for the whole column "R" till last available data in the row.


    Sub Vlookup()
    Dim ws1 As Worksheet, ws2 As Worksheet
    Dim srchres As Variant

    Set ws1 = Workbooks("Trvl port 1").Sheets("EF")
    Set ws2 = Workbooks("TRVL DK").Sheets("Sheet1 (2)")

    On Error Resume Next
    srchres = Application.WorksheetFunction.Vlookup(ws2.Range("A2"), ws1.Range("A1:V65536"), 18, False)
    On Error GoTo 0
    If (IsEmpty(srchres)) Then
    ws2.Range("R2").Formula = CVErr(xlErrNA) ' Use whatever you want
    Else
    ws2.Range("R2").Value = srchres
    End If

    End Sub

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,829

    Re: VBA to copy down Vlookup VBA code in Column till last available data

    Please Login or Register  to view this content.
    If someone has helped you then please add to their Reputation

  3. #3
    Registered User
    Join Date
    09-10-2014
    Location
    India
    MS-Off Ver
    10
    Posts
    44

    Re: VBA to copy down Vlookup VBA code in Column till last available data

    Thank you for Quick reply ..

    I have tried this code but it is giving me error as Compile Error: Next without For

    Please help!!

  4. #4
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,829

    Re: VBA to copy down Vlookup VBA code in Column till last available data

    Try editing

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-10-2014
    Location
    India
    MS-Off Ver
    10
    Posts
    44

    Re: VBA to copy down Vlookup VBA code in Column till last available data

    It is not excepting
    Coming in RED color

  6. #6
    Registered User
    Join Date
    09-10-2014
    Location
    India
    MS-Off Ver
    10
    Posts
    44

    Re: VBA to copy down Vlookup VBA code in Column till last available data

    and If I using

    FullRange = "ws!R1:R" & Rows.End(xlUp).Value

    Then I am getting same error as Compile Error: Next without For

+ 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. copy column and it's row value till column blank found
    By nareshkt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2013, 03:20 AM
  2. Copy entire selected column to next columns till last column
    By siroos12 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-22-2013, 05:20 AM
  3. Copy data from textbox1 to column A till end of cell data of column B
    By JoaoFerreira1985 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-12-2013, 01:19 PM
  4. Copy Paste and Loop till last column with data
    By eirumba in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-08-2011, 07:23 AM
  5. Copy and Paste till last Last Column
    By dagindi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-16-2010, 05:43 PM

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