+ Reply to Thread
Results 1 to 7 of 7

problem highlighting row

Hybrid View

mehdoush problem highlighting row 06-25-2009, 01:09 PM
Richard Schollar Re: problem highlighting row 06-25-2009, 01:13 PM
mehdoush Re: problem highlighting row 06-25-2009, 01:25 PM
Richard Schollar Re: problem highlighting row 06-25-2009, 01:38 PM
mehdoush Re: problem highlighting row 06-25-2009, 01:15 PM
mehdoush Re: problem highlighting row 06-25-2009, 01:33 PM
mehdoush Re: problem highlighting row 06-29-2009, 05:35 PM
  1. #1
    Registered User
    Join Date
    02-20-2009
    Location
    La, CA
    MS-Off Ver
    Excel 2003
    Posts
    70

    problem highlighting row

    hello everyone...

    I'm using the code below to color every row where "MAIN" and string
    starting by "FFR0" coexist, but it doesn't work

    is there anything wrong with this code ?


    Dim cell As Range
    For Each cell In Intersect(Columns("A"), ActiveSheet.UsedRange)
    If Left(cell.Value, 5) = "MAIN" And Left(cell.Offset(0, 3).Value, 14) =
    "FFR0*" Then cell.EntireRow.Interior.ColorIndex = 3
    Next cell
    please take a look at the attached file.

    thanks in advance for your help
    regards...
    Attached Files Attached Files
    Last edited by mehdoush; 06-25-2009 at 01:34 PM.

  2. #2
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264

    Re: problem highlighting row

    Hi

    "MAIN" is 4 characters long not 5 and "FFR0*" is 5 characters long not 14 - hnece your problem. Try amending to:

    Dim cell As Range
    For Each cell In Intersect(Columns("A"), ActiveSheet.UsedRange)
    If Left(cell.Value, 4) = "MAIN" And Left(cell.Offset(0, 3).Value, 4) =
    "FFR0" Then cell.EntireRow.Interior.ColorIndex = 3
    Next cell
    I removed the * from the second comparison as I suspect you just want to know if the cell starts with FFR0?

    Richard
    Richard Schollar
    Microsoft MVP - Excel

  3. #3
    Registered User
    Join Date
    02-20-2009
    Location
    La, CA
    MS-Off Ver
    Excel 2003
    Posts
    70

    Re: problem highlighting row

    attached files...
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264

    Re: problem highlighting row

    You are modifying the text file in your subsequent code and when you run the avertMain routine before the modification code, none of your rows actually have MAIN in column A and FFR0 in column D. So, you just need to change the order the macros are called in in the tst sub:

      Call Module3.SuppLignes
      Call Module2.tableau
      Call Module2.avertMain

  5. #5
    Registered User
    Join Date
    02-20-2009
    Location
    La, CA
    MS-Off Ver
    Excel 2003
    Posts
    70

    Re: problem highlighting row

    hey Richard,

    it works just fine , thanks a lot ...

    but when trying to test it on a text file it didn't work...

    below two attached files txt file, and excel file with button "OpenText"

    see plz
    Last edited by mehdoush; 06-25-2009 at 01:23 PM.

  6. #6
    Registered User
    Join Date
    02-20-2009
    Location
    La, CA
    MS-Off Ver
    Excel 2003
    Posts
    70

    Re: problem highlighting row

    i think i solved the problem it works properly thanks a lot ...

  7. #7
    Registered User
    Join Date
    02-20-2009
    Location
    La, CA
    MS-Off Ver
    Excel 2003
    Posts
    70

    Re: problem highlighting row

    thanks a lot Richard Schollar

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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