Results 1 to 10 of 10

Thread: New to VBA - Basic Macro Help Needed

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Seeker Peg's Avatar
    Join Date
    May 2021
    Posts
    5
    Articles
    0
    Excel Version
    Windows 10

    Question New to VBA - Basic Macro Help Needed

    Hello, I am new to VBA and this forum. I am hoping someone has a moment to help me?

    The macro, below, is executed by clicking one of three choices in a combobox. The combobox is linked to cell "L5". Each time one of the options (Turn, River, Other) is chosen, the result in cell "O14 is the same...the value from the last line executed under "Else".
    I have tested the "Index" functions (one at a time) in the Master sheet formula bar, and the results were correct for each. Your time and assistance is appreciated.

    Code:
    Sub StreetChoice()
    
    
     'To match street choice to options
     
        If Range("L5") = "Turn" Then
            Range("O14").Value = "= Index(G58:G80,match(I6,E58:E80,0))"
     
        ElseIf Range("L5") = "River" Then
            Range("O14").Value = "= Index(H58:H80,match(I6,E58:E80,0))"
        
        Else
            Range("O14").Value = "= Index(I58:I80,match(I6,E58:E80,0))"
     
        End If
    
    
    End Sub
    Last edited by p45cal; 2021-05-12 at 10:06 AM. Reason: added code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •