Results 1 to 3 of 3

Run Time Error 9: Subscript Out of Range

Threaded View

jason_kelly Run Time Error 9: Subscript... 02-14-2011, 12:54 PM
snb Re: Run Time Error 9:... 02-14-2011, 01:10 PM
jason_kelly Re: Run Time Error 9:... 02-14-2011, 01:44 PM
  1. #1
    Registered User
    Join Date
    07-22-2010
    Location
    Ontario
    MS-Off Ver
    Excel 2003
    Posts
    71

    Run Time Error 9: Subscript Out of Range

    Hi There,

    I need your help.

    I have now idea why I would be getting a Run-Time Error #9 "Subscript out of Range" with the following function:

    I desperately need your help:

    
    Dim today As Variant
      Dim Date2 As Variant
    
        Date2 = frmIMTS.h10.Value
        
        today = Split(Format(Date, "dd/mm/yyyy"), "/")
        today = DateSerial(CInt(today(2)), CInt(today(1)), CInt(today(0))) <- Errors here
        
        Date2 = Split(Date2, "/")
        Date2 = DateSerial(CInt(Date2(2)), CInt(Date2(1)), CInt(Date2(0)))
        
        DaysDue = DateDiff("d", today, Date2)
        
       
        If DaysDue < 0 Then
        frmIMTS.h10.BackColor = RGB(255, 192, 192)
        msg_eng = "is over due by " & Abs(DaysDue) & " day(s)."
        msg_fre = "est en retard par " & Abs(DaysDue) & " jour(s)."
        
        ElseIf DaysDue > 0 Then
        frmIMTS.h10.BackColor = RGB(192, 255, 192)
        msg_eng = "will be due in " & DaysDue & " day(s)."
        msg_fre = "sera dû dans " & DaysDue & " jour(s)."
        
        ElseIf DaysDue = 0 Then
        frmIMTS.h10.BackColor = RGB(255, 255, 192)
        msg_eng = "is due today."
        msg_fre = "est dû aujourd'hui."
        End If
    Any help with this is greatly appreciated.

    Much thanks and appreciation.

    Cheers,

    Jay
    Last edited by jason_kelly; 02-14-2011 at 01:44 PM.

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