Results 1 to 10 of 13

Thread: Error when running VLookup

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #9
    Member p45cal's Avatar
    Join Date
    Oct 2013
    Posts
    94
    Rep Power
    12
    Quote Originally Posted by mcbrocks View Post
    all except for the first cells property: Cells(10, Column). It's showing the correct column, but the value of this cell, is from my active sheet and not the referenced sheet, meaning: It shows: Worksheets(DataPVC2) <--in the pop up box. BUT the cell displays the value from Worksheets(DataThermo2) <-- or whatever worksheet is active.
    I think you've nailed it - and I should have seen this - the range is not properly qualified; the Cells(…) parts need to be qualified:
    Code:
    With Worksheets(WorksheetName)
      VoltageDrop = WorksheetFunction.VLookup(Val(LoadCurrentText.Text), .Range(.Cells(10, Column), .Cells(26, VoltageDropColumn)), ReturnColumn)
    End With
    paying especial attention to the dots in the code. The With… End With consruct could probably span more than one line.
    Last edited by p45cal; 02-27-2014 at 04:11 PM.

Similar Threads

  1. Replies: 1
    Last Post: 10-30-2013, 10:27 PM
  2. Macro stops running if date is not in past...
    By Carlos Arruda in forum Excel Help
    Replies: 4
    Last Post: 03-10-2013, 04:33 PM
  3. Saving and Running Macro For Multiple Files / Users
    By Charles_ in forum Excel Help
    Replies: 1
    Last Post: 01-07-2013, 09:10 AM
  4. Workbook Event running VBA question
    By jamilm in forum Excel Help
    Replies: 4
    Last Post: 12-29-2012, 12:12 AM
  5. Running a VBA in all excel files
    By msiyab in forum Excel Help
    Replies: 3
    Last Post: 12-26-2012, 01:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •