dcsimg
Results 1 to 10 of 10

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2018
    Posts
    5

    Function input is string, then search that string ... IndexOf not working (Excel2010)

    Hi, I have generated a function that is used in a cell in excel. The input to the function is called mission and its just text written into a cell (in excel).

    Code:
    Function test(mission As String)
    
      index_x = mission.IndexOf("X")
      index_t = mission.IndexOf("T")
    
      if index_x > index_t Then
         test = Range("E1")
      Else
         test = Range("E2")
      End If
    
    End Function
    But it does not get past index_x=mission.IndexOf("X")

    Ive tried aswell as a multitude of different code lines
    Code:
    Function test(mission)
    index_x = mission.text.IndexOf("X")
    The cell defiantly contains the letter X! Please help
    Last edited by NateKJ; Mar 8th, 2018 at 09:11 AM. Reason: Been told this is VB for Applications.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width


×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.