stuck at vlookup function!!!!

adr12345

Board Regular
Joined
Jan 19, 2015
Messages
67
Sub lkup()
Dim rng As String
rng = Range("A1", Range("A1").End(xlToRight).End(xlDown)).Select
Dim count As Integer
count = Application.WorksheetFunction.Match("City", Sheets("carrierresponse_list").Rows(1), 0)
MsgBox count
Range("B2") = WorksheetFunction.VLookup(Range("A2").Value, Sheets("carrierresponse_list").Range("A1:HS137"), count, 0)
End Sub


I am getting error Run-time error '1004': Unable to get the VLookup property of the WorksheetFunction class


Plss helpp!!!!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Does this work any better?

Code:
Sub lkup()
Dim rng As String
Dim count As Integer
 
 rng = Range("A1", Range("A1").End(xlToRight).End(xlDown)).Select
 count = Application.WorksheetFunction.Match("City", Sheets("sheet1").Rows(1), 0)
 MsgBox count
 
 With Range("B2")
    .Formula = "=VLOOKUP(A2, carrierresponse_list!A1:HS137, " & count & ", 0)"
    .Value = .Value
 End With

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,647
Messages
6,120,722
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top