Results 1 to 16 of 16

Assistance with Compile Error: Type Mismatch VBA Code

Threaded View

Pauly723 Assistance with Compile... 12-22-2014, 06:14 PM
pjwhitfield Re: Assistance with Compile... 12-22-2014, 06:22 PM
Pauly723 Re: Assistance with Compile... 12-22-2014, 06:37 PM
protonLeah Re: Assistance with Compile... 12-22-2014, 06:25 PM
gmr4evr1 Re: Assistance with Compile... 12-22-2014, 06:34 PM
Pauly723 Re: Assistance with Compile... 12-22-2014, 06:42 PM
pjwhitfield Re: Assistance with Compile... 12-22-2014, 06:46 PM
jindon Re: Assistance with Compile... 12-22-2014, 06:40 PM
Pauly723 Re: Assistance with Compile... 12-22-2014, 06:46 PM
pjwhitfield Re: Assistance with Compile... 12-22-2014, 06:44 PM
jindon Re: Assistance with Compile... 12-22-2014, 06:50 PM
Pauly723 Re: Assistance with Compile... 12-23-2014, 12:39 PM
jindon Re: Assistance with Compile... 12-23-2014, 12:47 PM
Pauly723 Re: Assistance with Compile... 12-23-2014, 01:00 PM
jindon Re: Assistance with Compile... 12-23-2014, 01:06 PM
Pauly723 Re: Assistance with Compile... 12-23-2014, 01:14 PM
  1. #1
    Registered User
    Join Date
    12-22-2014
    Location
    Madison, WI
    MS-Off Ver
    MS Office 2013
    Posts
    33

    Assistance with Compile Error: Type Mismatch VBA Code

    Hello,

    I've been searching endlessly for assistance with a specific piece of code that I've written. Specifically, I keep getting a Compile Error: Type Mismatch error when trying to step through my code at the first "<" sign in my If statement. Also, I've tried to substitute a case statement for the If statement and still ended up with the same type of error. Any assistance would be greatly appreciated. Thank you

    Sub CalculatingEndDateStatus()
    
        Dim NumberOfDays() As Variant
        Dim Answer2() As Variant
        Dim Dimension2 As Long, Counter As Long
        
        Sheet2.Activate
        
        NumberOfDays = Range("G2", Range("G2").End(xlDown))
        
        Dimension2 = UBound(NumberOfDays, 1)
        
        ReDim Answer2(1 To Dimension2, 1 To 2)
        
        For Counter = 1 To Dimension2
        
            If NumberOfDays < 0 Then
                Answer2(Counter, 1) = "Past End Date"
            ElseIf NumberOfDays < 30 Then
                Answer2(Counter, 1) = "Less Than 1 Month"
            ElseIf NumberOfDays < 60 Then
                Answer2(Counter, 1) = "Less Than 2 Months"
            ElseIf NumberOfDays < 90 Then
                Answer2(Counter, 1) = "Less Than 3 Months"
            Else
                Answer2(Counter, 1) = "More Than 3 Months"
            End If
            
        Next Counter
        
        Range("H2", Range("H2").Offset(Dimension2 - 1, 1)).Value = Answer2
        
        Erase NumberOfDays
        Erase Answer2
    
    End Sub
    Last edited by Pauly723; 12-22-2014 at 06:31 PM. Reason: Rule 3 Adherence

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Compile error: Type mismatch
    By jacob@thepenpoint in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-10-2014, 09:41 AM
  2. Compile Error - Type Mismatch
    By Will B in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-30-2012, 11:17 AM
  3. Adding Header via Add-In - Compile error: Type Mismatch
    By koticphreak in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-01-2009, 12:13 PM
  4. Compile Error - Type Mismatch in VBA
    By Hotmail in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-03-2009, 01:05 AM
  5. [SOLVED] Help: Compile error: type mismatch: array or user defined type expected
    By lvcha.gouqizi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-31-2005, 05:05 PM

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