Consulting

Results 1 to 5 of 5

Thread: Highlight Cell if it contains a specific character in specific position.

  1. #1
    VBAX Contributor
    Joined
    Jul 2011
    Location
    Manchester
    Posts
    142
    Location

    Highlight Cell if it contains a specific character in specific position.

    Hi folks - i need help again please but not sure if it is possible

    I have a spreadsheet which has a sort code and account number in column B in this format 000000 08000000. There will always be a space between the 2 sets of numbers too

    i need to be able to highlight any cell that has an 8 in the same position as above.

    I've tried using wildcards in a formula as belwo but can't get it to work

    =IF(B2="?????? ?8??????","Yes","No")

    Can anyone help please?

    Thank you
    Last edited by mykal66; 06-26-2012 at 09:00 AM.

  2. #2
    VBAX Tutor
    Joined
    Jun 2012
    Posts
    269
    Location
    well, if you know it will always be the 9th character in, its very easy to:

    [vba]If Mid(Sheet4.Cells(1, 1), 9, 1) = 8 Then
    Sheet4.Cells(1, 1).Interior.ColorIndex = 4
    End If[/vba]

    Obviously, you will change sheet4.cells(1,1) to the cell you are checking...

  3. #3
    VBAX Contributor
    Joined
    Jul 2011
    Location
    Manchester
    Posts
    142
    Location

    Thank you

    Thanks very much. Will make life much easier than manually looking down a huge column

  4. #4
    VBAX Tutor
    Joined
    Jun 2012
    Posts
    269
    Location
    You could also do a conditional formatting with a formula like
    =mid(A1,9,1)="8"
    for the range you want...

  5. #5
    VBAX Contributor
    Joined
    Jul 2011
    Location
    Manchester
    Posts
    142
    Location
    Hi again

    This is much easier for me to show someone else how to do. Thank you again

Posting Permissions

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