+ Reply to Thread
Results 1 to 12 of 12

IF cycle with variables - Error 2015

Hybrid View

  1. #1
    Registered User
    Join Date
    10-30-2012
    Location
    Budapest
    MS-Off Ver
    Excel 2003
    Posts
    14

    IF cycle with variables - Error 2015

    Hello,

    Could you please help me with a strange error, unfortunately I cannot find similar threads with solution.

    I have a file where in column F I have a flow of IF formulas which results can be "No updates" or "Updated".

    I want to collect each of the items from column A where we have "No updates" in column F.

    I wrote the below code to do it, and it works fine sometimes, but sometimes it gives error "Type mismatch" and for the value in Cells(i,6) I have Error 2015 at that time.

    Could you please help here?

    Thank you in advance!



    comma = 0

    For i = 5 To lastfxticker



    If Cells(i, 6) <> "Updated" Then


    fxticker = UCase(Cells(i, 1))

    If comma <> 0 Then


    listoffxticker = listoffxticker & " , " & fxticker

    Else: listoffxticker = fxticker
    comma = 1
    End If

    Else: fxticker = ""
    End If

    Next

    Else: nofxupdate = ""
    End If

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: IF cycle with variables - Error 2015

    what is the value of that cell?
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: IF cycle with variables - Error 2015

    2015 is a #VALUE error
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  4. #4
    Registered User
    Join Date
    10-30-2012
    Location
    Budapest
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: IF cycle with variables - Error 2015

    Hello,
    Thank you for coming back to me that quickly.

    the formula I use there is a quite long one:

    =IF(C5="","",IF(C5="","",IF(AND(E5="T-1",DATEVALUE(C5)=$V$1-1),"Updated",IF(AND(E5="T+1",DATEVALUE(C5)=$V$1+1),"Updated",IF(AND(E5="T",DATEVALUE(C5)=$V$1),"Updated","No updates")))))

    and it has a result "No updates", so it should go to my listoffxticker variable, however it doesn't...

  5. #5
    Registered User
    Join Date
    10-30-2012
    Location
    Budapest
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: IF cycle with variables - Error 2015

    I believe the issue should be with the cell(i,6) not using the formula result but the formula instead, no?



     comma = 0
                
                For i = 5 To lastfxticker
                
                                       
                        
                    If Cells(i, 6) <> "Updated" Then
                        
                        
                        fxticker = UCase(Cells(i, 1))
                            
                        If comma <> 0 Then
                        
                         
                         listoffxticker = listoffxticker & " , " & fxticker
                        
                        Else: listoffxticker = fxticker
                                comma = 1
                        End If
                        
                    Else: fxticker = ""
                    End If
                    
                Next
                
    Else: nofxupdate = ""
    End If

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: IF cycle with variables - Error 2015

    no-I think you have a #VALUE error in the sheet. what's the value of i when the error happens?

  7. #7
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: IF cycle with variables - Error 2015

    Try changing this
    fxticker = UCase(Cells(i, 1))
    to
    If Not IsError(Cells(i, 1)) Then fxticker = UCase(Cells(i, 1))

  8. #8
    Registered User
    Join Date
    10-30-2012
    Location
    Budapest
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: IF cycle with variables - Error 2015

    Solus, thank you for that, however it doesn't solve my issue.

    Actually the macro stops at
     If Cells(i, 6) <> "Updated" Then
    line when it sees that Erorr 2015 in the cell, but cell actually doesn't show any VALUE error, it shows "No updates".

    And I run this code on several sheets, having the same format and same functions in all of them and it stops only on two of the sheets, others go nicely.
    I tried to delete those sheets and do them again, same result.

    I have no idea what goes wrong here.

    Thank you for helping

  9. #9
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: IF cycle with variables - Error 2015

    If Not IsError(Cells(i, 6).Value) Then
    If Cells(i, 6) <> "Updated" Then
    ...
    end if
    what's the value of i?

  10. #10
    Registered User
    Join Date
    10-30-2012
    Location
    Budapest
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: IF cycle with variables - Error 2015

    Lovely, it is working now!

    thank you very much!

  11. #11
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: IF cycle with variables - Error 2015

    If you are happy with the solution please mark the thread as [SOLVED] using the thread tools at the top.

  12. #12
    Registered User
    Join Date
    10-30-2012
    Location
    Budapest
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: IF cycle with variables - Error 2015

    It is done, thank you!

+ 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. [SOLVED] Stupid Input Box Error 2015
    By tomn13 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 11-05-2012, 11:17 AM
  2. [SOLVED] Error 2015 with Application.Evaluate
    By Jeff in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-06-2006, 11:10 AM
  3. Error 2015
    By Jeff in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-25-2006, 03:40 PM
  4. [SOLVED] N/A # and error 2015
    By ina in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-27-2006, 05:55 AM
  5. [SOLVED] error 2015 performing vlookup
    By SP in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-18-2005, 01:05 AM

Tags for this Thread

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