+ Reply to Thread
Results 1 to 3 of 3

IF/ELSEIF not working as expected

Hybrid View

amphinomos IF/ELSEIF not working as... 08-12-2015, 08:25 AM
The_Greg Re: IF/ELSEIF not working as... 08-12-2015, 09:17 AM
amphinomos Re: IF/ELSEIF not working as... 08-12-2015, 10:00 AM
  1. #1
    Forum Contributor
    Join Date
    05-30-2013
    Location
    France
    MS-Off Ver
    2010
    Posts
    260

    IF/ELSEIF not working as expected

    Hey,

    I've got a loop running which holds an IF/ELSEIF. They work on the pretty much the same conditions but only the IF works and never the ELSEIF.

    For cellCount = 1 To lastcell 'example : 1 to 150
    If quoteSheet.Cells(cellCount, 3).Value = "SYSTEM" Then
    'Do this
    ElseIf quoteSheet.Cells(cellCount, 4).Value = "MISCELLANEOUS" Then
    'Do that
    End If
    Next cellCount
    Anything obvious I'm missing here ?

    Thanks,
    amphi

  2. #2
    Registered User
    Join Date
    08-05-2015
    Location
    Finland
    MS-Off Ver
    Home and Business 2013
    Posts
    50

    Re: IF/ELSEIF not working as expected

    1. In your Elseif you have column 4, is that right? -in If it is 3.

    2. Maybe just a typo in Elseif "MISCELLANEOUS" or in your column 4 there is no such word.

    3. Did you give your variable "lastcell" a value in "For cellCount = 1 To lastcell"?

  3. #3
    Forum Contributor
    Join Date
    05-30-2013
    Location
    France
    MS-Off Ver
    2010
    Posts
    260

    Re: IF/ELSEIF not working as expected

    Seems to the issue is coming from somewhere else !
    Last edited by amphinomos; 08-12-2015 at 10:13 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. If ElseIf Else Statement not working
    By lazyserv in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-28-2015, 03:38 AM
  2. COUNTIF() not working as expected?
    By Neely8 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 02-28-2015, 09:28 AM
  3. [SOLVED] If-ElseIf-Else Macro has stopped working
    By HabsFan89 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-09-2015, 10:57 AM
  4. [SOLVED] If Then ElseIF not working as I want
    By capson in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-30-2014, 05:12 PM
  5. Code stepping in to elseif statement when elseif is definitely not true
    By DFrank231 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-13-2013, 05:31 PM
  6. If then elseif statement not working.........
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-11-2011, 02:27 PM
  7. [SOLVED] IF statement is not working as expected?
    By Aland2929 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-31-2009, 02:02 PM

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