The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.

Minor Excel VBA problem

DrezDrez Registered User regular
edited October 2008 in Help / Advice Forum
I'm familiar with Excel XP (2002) VBA programming. I have Excel 2007 at home. I decided to bring my little project home with me. Coding up a storm here. My code requires me to use the rather common MID function. But it's not recognizing the MID function. What am I missing? I know it's a part of Excel 2007 VBA. The MID function works fine as a formula in a worksheet. =MID(B7, 3, 5) works in a cell, for instance. What's missing?

Here's my code if you want to see:
Sub A_TEST_01()
'Input Value Get (Test)

    Dim oWS As Worksheet
    Set oWS = Sheets("Data")
    
    Dim oWS_Flash_Inputs As Worksheet
    Set oWS_Flash_Inputs = Sheets.Add
    oWS_Flash_Inputs.Name = "INPUTS"
    
    Dim sCurrentRC As String
    sCurrentRC = ""

    'Set the column where the data exists on the data worksheet
    Const iRC_Column As Integer = 2
    Const iValue_Column As Integer = 5    
       
    Dim iRC_Row, iRC_String_Begin, iRC_String_End, iRC_String_Length As Integer
    Dim sRC As String
    
    For iRC_Row = 8 To 15
        sCurrentRC = oWS.Cells(iRC_Row, iRC_Column)
        iRC_String_Begin = InStrRev(sCurrentRC, "(")
        iRC_String_End = InStrRev(sCurrentRC, ")")
        iRC_String_Length = iRC_String_End - iRC_String_Begin
        sRC = Mid(sCurrentRC, iRC_String_Begin, iRC_String_Length)
        MsgBox sRC
    Next iRC_Row

Anyway, when I run the macro, I get the following error:

vba_error_1.jpg

And it highlights the mid function. Yes, I tried to step through and it does the same thing, at that point in my code.

My soul is weary and I just can't fucking figure out why the MID function is coming up as non-existent. What am I missing here?

I would explain my code, and I will if you want, but it's not really important. I'm pretty sure my algorithm is right, but for the life of me I can't figure out why the compiler does not like my use of MID here.
Do While Not Head_Is_Bleeding
    BashHead
Loop

Switch: SW-7690-2320-9238Steam/PSN/Xbox: Drezdar
Drez on
Sign In or Register to comment.