Results 1 to 13 of 13

Vlookup VBA based on date

Threaded View

  1. #1
    Registered User
    Join Date
    02-15-2009
    Location
    NJ
    MS-Off Ver
    Excel 2003
    Posts
    8

    Vlookup VBA based on date

    Hi All,

    I'm having trouble getting my vlookup formula to work in vba. Basically, I have a range of dates in column A and want to the vlookup to fill these in until there are no dates available. The reason I want to do this in VBA opposed to on the spreadsheet, is that I have large subset of time series data which needs to be frequently updated and wish for the data in column C to be updated everytime the macro is run.

    My code is below. I keep on getting a runtime error 13 on the highlighted line below. Any input would be great!

    Sub updated()
    Dim i As Integer
    Dim D As Date
     i = 1
     D = Cells(i, 1).Value
      Do Until D = ""
        D = Cells(i, 1).Value
         Cells(i, 3).Value = WorksheetFunction.VLookup(D, "Pricelist", 2, 0)
          i = i + 1
       Loop
     
    End Sub
    Last edited by Rawlings99; 02-16-2009 at 01:18 PM.

Thread Information

Users Browsing this Thread

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

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