+ Reply to Thread
Results 1 to 3 of 3

Argument for contain instead of equals

  1. #1
    Registered User
    Join Date
    09-17-2005
    Location
    Toronto
    Posts
    10

    Argument for contain instead of equals

    My routine looks to see if the active cell is equal to "TEST" , does anyone know what argument I can use to see if the cell CONTAINS "TEST" for example if the active cell ="Sample TEST" it would still work.


    Dim i As Integer
    Dim intRowCount As Integer
    intRowCount = Range("A1").CurrentRegion.Rows.Count - 1
    For i = 1 To intRowCount
    'turns it green if equal to "TEST"
    If ActiveCell.Offset(0, 12).Value = "TEST"

    With Selection.Interior
    .ColorIndex = 4
    .Pattern = xlSolid
    End With
    End If
    ActiveCell.Offset(1, 0).Select
    Next i

  2. #2
    Gary''s Student
    Guest

    RE: Argument for contain instead of equals

    Use the InStr() function.

    so instead of if range.value=sometext
    if InStr(range.value, sometext)=TRUE
    --
    Gary''s Student


    "icdoo" wrote:

    >
    > My routine looks to see if the active cell is equal to "TEST" , does
    > anyone know what argument I can use to see if the cell CONTAINS "TEST"
    > for example if the active cell ="Sample TEST" it would still work.
    >
    >
    > Dim i As Integer
    > Dim intRowCount As Integer
    > intRowCount = Range("A1").CurrentRegion.Rows.Count - 1
    > For i = 1 To intRowCount
    > 'turns it green if equal to "TEST"
    > If ActiveCell.Offset(0, 12).Value = "TEST"
    >
    > With Selection.Interior
    > .ColorIndex = 4
    > .Pattern = xlSolid
    > End With
    > End If
    > ActiveCell.Offset(1, 0).Select
    > Next i
    >
    >
    > --
    > icdoo
    > ------------------------------------------------------------------------
    > icdoo's Profile: http://www.excelforum.com/member.php...o&userid=27342
    > View this thread: http://www.excelforum.com/showthread...hreadid=468511
    >
    >


  3. #3
    Registered User
    Join Date
    09-17-2005
    Location
    Toronto
    Posts
    10
    Thank you,

    I just need some time to try it out.

+ Reply to Thread

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