Macro Vlookup help?
To any one who is an expert at macros in excel, I was wondering if you could help me out. I am trying to use 2 sheets to run a vlookup that will look up a customer id # and return the corresponding month associated with booking that customer from the second workbook. They are both tables. So basically I just need to look up CustomerID from sheet 1 in sheet 2 and then paste the value of the month from sheet 2 into sheet 1. This is what I have so far. We run it every month and I would like to have a quicker process if at all possible. Thanks!
Sub Vlookup()
Dim mylookupvalue As String Dim myfirstcolumn As Long Dim mylastcolumn As Long Dim mycolumnindex As Long Dim myfirstrow As Long Dim mylastrow As Long Dim myvlookupresult As Long
Dim previousmonth As Range
mylookupvalue = "CustID" myfirstcolumn = 2 mylastcolumn = 15 mycolumnindex = 11 myfirstrow = 1 mylastrow = 500
With Worksheets("priormonth") Set mytablearray = .Range(.Cells(myfirstrow, myfirstcolumn), .Cells(mylastrow, mylastcolumn)) End With
myvlookupresult = WorksheetFunction.Vlookup("CustID", sheet2, 11, False)
End Sub
corpfincorpcredit, bummer your thread hasn't had a response yet. Maybe one of these threads could point you in the right direction:
Hope that helps.
Quia provident optio sapiente. Totam ut rem voluptatum nihil maiores. Neque et esse consequatur rerum non ullam. Distinctio inventore quas alias quos eius nihil. Accusamus impedit architecto sunt eos qui ut doloremque. Sit reprehenderit suscipit vero illum ex.
Esse aut a consequuntur quasi. Quaerat nisi quae ut ea aut dolorem qui pariatur. Facere magni eligendi optio sunt dolores. Enim molestias eius porro reiciendis quasi ullam. Ut et molestiae numquam ut consequuntur aperiam tenetur. Consequatur ea laudantium maiores voluptas distinctio. Quos cumque mollitia optio eligendi ab neque quo sit.
Aut error sapiente odio. Sit ea consequatur ipsa autem aut rerum eaque reiciendis. Quis accusantium voluptatibus assumenda deserunt voluptates. Necessitatibus minima delectus illum placeat.
Tempore aut temporibus quis dolores aut maxime aperiam. Illo ducimus amet et nesciunt quis molestiae cupiditate. Facere provident mollitia repudiandae ut ab voluptatem. Eum fugiat rerum provident.
See All Comments - 100% Free
WSO depends on everyone being able to pitch in when they know something. Unlock with your email and get bonus: 6 financial modeling lessons free ($199 value)
or Unlock with your social account...