Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

VLookup in VBA

  Asked By: Gwendolyn    Date: Jan 04    Category: MS Office    Views: 832
  

I need help getting this code to work ... specifically the the
intersect portion ... vValue works ... getting this error message:

Method 'Intersect' of object '_Global' failed runtime error 1004

Dim iLastRow As Long
Dim vValue As Variant
Dim newMonthData As Workbook
Dim PrevMonth As Workbook
Set PrevMonth = Workbooks.Open("C:\Felix\ED501531.2889.xls", 3, , 2)
Set newMonthData = Workbooks.Open("c:\Felix\tempMonthData.xls", 3, , 2)

iLastRow = newMonthData.Sheets("tempMonthData").Range("A65536").End
(xlUp).Row

'vValue = Application.vLookup(newMonthData.Sheets("tempMonthData").Range
("A1"), PrevMonth.Sheets("ed501531.2889").Range("A1:CC5000"), 36, False)

Intersect([AX:AX], ActiveSheet.UsedRange).FormulaR1C1 = "=VLOOKUP
(tempmonthdata!RC1, " & PrevMonth.Worksheets("ed501531.2889").Range
("A:CC").Address(ReferenceStyle:=xlR1C1, External:=True) & ",36, FALSE)"

newMonthData.Close True
PrevMonth.Close True

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on VLookup in VBA Or get search suggestion and latest updates.




Tagged: