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 ?
please take a look at the attached file.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
thanks in advance for your help
regards...
Last edited by mehdoush; 06-25-2009 at 02:34 PM.
Hi
"MAIN" is 4 characters long not 5 and "FFR0*" is 5 characters long not 14 - hnece your problem. Try amending to:
I removed the * from the second comparison as I suspect you just want to know if the cell starts with FFR0?Code: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
Richard
Richard Schollar
Microsoft MVP - Excel
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 02:23 PM.
attached files...
i think i solved the problem it works properly thanks a lot ...
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:
Code:Call Module3.SuppLignes Call Module2.tableau Call Module2.avertMain
Richard Schollar
Microsoft MVP - Excel
thanks a lot Richard Schollar
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks