Results 1 to 10 of 13

Thread: Error when running VLookup

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #10
    Junior Member
    Join Date
    Feb 2014
    Posts
    8
    Rep Power
    0
    p45cal, it works!!! I didn't know it had to be so specific. But however, I have some cells within the range that contain a 0 value. This throws off the desired result. Is there any line that can be put in to rectify the error? I tried this:
    Code:
        If Worksheets(WorksheetName).Range(Worksheets(WorksheetName).Cells(10, Column), Worksheets(WorksheetName).Cells(26, Column)).Value = 0 Then
            Ans = MsgBox("This method does not exist for " & WorksheetName & ".", vbRetryCancel + vbExclamation)
            If Ans = vbRetry Then CableSizingSelection.UndoAction
            If Ans = vbCancel Then Unload CableSizingSelection
        End If
    But the first If line is giving trouble.

    Is there any other way to avoid the error? There are some columns where only the last few rows contain 0s and if the lookup value can be found within the top few lines, the program would have to work correctly. I realized the retry cancel actually searches for 0 values whether it affects the result or not. Maybe I could shorten the lookup range. Like say have the range from row 10 to the last non-0 cell?
    Last edited by mcbrocks; 02-28-2014 at 08:02 AM.

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
  •