+ Reply to Thread
Results 1 to 4 of 4

If with Or

  1. #1
    Forum Contributor
    Join Date
    02-24-2010
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    195

    Question If with Or

    I'm getting a

    Run-time Error'13';

    Type mismatch

    on the below piese of code. Is there somthing wrong with the synthax?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: If with Or

    It should be
    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Forum Contributor
    Join Date
    02-24-2010
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    195

    Re: If with Or

    Your a gentleman! Thank you for your promt responce!

  4. #4
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: If with Or

    Hi TonyforVBA

    I suggest that when testing your variable against multiple results you use Select Case instead of multiple If type statements

    Using Select Case is easier to write, read and much faster to execute as file_name is checked eachtime it is refered to
    Select Case = 1 times
    If with multiple OR = 4 times in your posted code

    Select Case file_name
    Case "corporarate", "Corporate ROI"
    Application.Run "'Formatting marco for Lists - Group Leader.xls'!Region_Branch_Name_List"
    Case Else
    Application.Run "'Formatting marco for Lists - Other.xls'!Region_Branch_Name_List_Formatting_Macro"
    End Select
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1