+ Reply to Thread
Results 1 to 5 of 5

VBA Else If

  1. #1
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    VBA Else If

    Hi, I wonder whether someone may be able to help me please.

    With some help along the way I've put together the following code to perform various actions on selected columns within a sheet along the way.

    Please Login or Register  to view this content.

    Firstly, I admit the code may be a little clumsy, and I'm more than happy to be shown a more efficient way of writing this, but I have a problem with this part of the script:

    Please Login or Register  to view this content.
    Although this code is held in the 'Else' statement, does not perform the 'Conditional Format' and I'm at a loss as to why.

    I just wondered whether someone could possibly look at this please and let me know where I'm going wrong.

    Many thanks and the kindest regards

  2. #2
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: VBA Else If

    You have not provided the sheet object for those ranges:
    Please Login or Register  to view this content.
    must be written as:
    Please Login or Register  to view this content.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA Else If

    What happens if you change it to this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  4. #4
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Else If

    Hi, @Izandol, thank you very much for takingn the time to reply to my post. Thank you also for setting me straught with this. It now works perfectly.

    All the best and kind regards

  5. #5
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Else If

    Hi @Norie, thank you very much for taking the time to reply to my post and for taking the time to set me straight. The code now works perfectly.

    May I also ask, because I'm fairly new to writing VB, could you perhaps tell me please, is there a more efficient way to write this. It looks a little clumsy that's all.

    Many thanks and kind regards

+ 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