“Unable to get the VLookup property of the WorksheetFunction Class” error

lougs7

New Member
Joined
Oct 9, 2015
Messages
6
Hi all, I am trying to set the values in column B in my Workbook "Copy of Dash Board Shell" (shown in the image below) equal to the value derived from my HLOOKUP function from my data workbook shown as second image below

Copy of Dash Board Shell
423939d1444420800-unable-to-get-the-vlookup-property-of-the-worksheetfunction-class-error-capture.png


Data file
423940d1444420841-unable-to-get-the-vlookup-property-of-the-worksheetfunction-class-error-capture-1.png


so esentially the code will find a match in the data file and copy its MIS number and paste it in the desired location on the Dash Board file, heres my code, I keep getting an error because I dont know the syntax, can someone help?


Code:
<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit;">Sub RetrieveData()

    Dim wbDash              As Workbook 'workbook where the data is to be pasted
    Dim wbData              As Workbook 'workbook from where the data is to copied
      
    
    'set to the current active workbook to Dashboard
    Set wbDash = ActiveWorkbook
    'Setting data sheet
    Set wbData = Workbooks.Open("C:\Users\673157897\Documents\Pro Fees Dash Board\Copy of Data.xls")
  
    Workbooks("Copy of Dash Board Shell").Worksheets("Data").Activate
       
With Sheets("Data")

    ' Selects the first cell to check
    Range("A3").Select
    Dim x As Variant
    x = wbData.Worksheets("Sheet1").Range("A2:B7")
    Workbooks("Copy of Dash Board Shell").Worksheets("Data").Range("A3").Select
   
    ' Loops through all rows until an empty row is found
    Do Until IsEmpty(ActiveCell)

        Range(ActiveCell.Offset(0, 1) & ActiveCell.Row).Value = Application.WorksheetFunction.VLookup((ActiveCell.Column & ActiveCell.Row), x, 2, 0)
        ActiveCell.Offset(1, 0).Select

' error is the syntax of the VLOOKUP

    Loop
End With

Call wbData.Close(False)
End Sub

</code>
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
This:<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit;">

Range(ActiveCell.Offset(0, 1) & ActiveCell.Row)

is not a valid range object.
</code><code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit;">
</code>
 
Upvote 0
This:<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit;">

Range(ActiveCell.Offset(0, 1) & ActiveCell.Row)

is not a valid range object.
</code><code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit;">
</code>


I cahnged it to this...

"Range(ActiveCell.Offset (0,1).Value=WorksheetFunction.VLookup(ActiveCell, x, 2, 0)"

and I stillg et an error with syntax, do you know how to do this?
 
Upvote 0
I cahnged it to this...

"Range(ActiveCell.Offset (0,1).Value=WorksheetFunction.VLookup(ActiveCell, x, 2, 0)"

and I stillg et an error with syntax, do you know how to do this?
Try like this:

ActiveCell.Offset (0,1).Value=WorksheetFunction.VLookup(ActiveCell, x, 2, 0)
 
Upvote 0

Forum statistics

Threads
1,215,745
Messages
6,126,632
Members
449,323
Latest member
Smarti1

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