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

 
 

Laborum molestiae eum magni non et libero expedita. Velit assumenda sed doloribus et laborum alias.

Reprehenderit asperiores iusto praesentium eum at reiciendis dolor quis. Praesentium in tempore voluptatem corporis rem aspernatur autem. Eos inventore ipsum velit deserunt exercitationem quasi odit. Sit consequuntur exercitationem nostrum sed perferendis accusamus non quia. Adipisci vel corporis omnis praesentium.

Consequatur dolorem ipsum minus esse est nostrum voluptatem. Qui magnam enim quia occaecati deleniti. Labore iste ut culpa maiores necessitatibus.

Career Advancement Opportunities

April 2024 Investment Banking

  • Jefferies & Company 02 99.4%
  • Goldman Sachs 19 98.8%
  • Harris Williams & Co. New 98.3%
  • Lazard Freres 02 97.7%
  • JPMorgan Chase 03 97.1%

Overall Employee Satisfaction

April 2024 Investment Banking

  • Harris Williams & Co. 18 99.4%
  • JPMorgan Chase 10 98.8%
  • Lazard Freres 05 98.3%
  • Morgan Stanley 07 97.7%
  • William Blair 03 97.1%

Professional Growth Opportunities

April 2024 Investment Banking

  • Lazard Freres 01 99.4%
  • Jefferies & Company 02 98.8%
  • Goldman Sachs 17 98.3%
  • Moelis & Company 07 97.7%
  • JPMorgan Chase 05 97.1%

Total Avg Compensation

April 2024 Investment Banking

  • Director/MD (5) $648
  • Vice President (19) $385
  • Associates (87) $260
  • 3rd+ Year Analyst (14) $181
  • Intern/Summer Associate (33) $170
  • 2nd Year Analyst (66) $168
  • 1st Year Analyst (205) $159
  • Intern/Summer Analyst (146) $101
notes
16 IB Interviews Notes

“... there’s no excuse to not take advantage of the resources out there available to you. Best value for your $ are the...”

Leaderboard

1
redever's picture
redever
99.2
2
Betsy Massar's picture
Betsy Massar
99.0
3
BankonBanking's picture
BankonBanking
99.0
4
Secyh62's picture
Secyh62
99.0
5
kanon's picture
kanon
98.9
6
GameTheory's picture
GameTheory
98.9
7
CompBanker's picture
CompBanker
98.9
8
dosk17's picture
dosk17
98.9
9
numi's picture
numi
98.8
10
Kenny_Powers_CFA's picture
Kenny_Powers_CFA
98.8
success
From 10 rejections to 1 dream investment banking internship

“... I believe it was the single biggest reason why I ended up with an offer...”