For each construct does not work

  • Hello all,


    I am using a countif formula on a range in all sheets in a workbook (specifically range P2 to P500). If the occurence is >= 2 then I want to colour the background in the cell blue, however I want to do this accross all worksheets in the active workbook. For some reason it does not work, can anyone see what I have done wrong?



    :thanx:
    Robert

    .¸¸·´¯'·.¸¸.·´¯'·.¸¸·´¯'·.¸¸.·´¯'·.¸¸·´¯'·.¸¸.· ><((((º>

  • Re: For each construct does not work


    The reason this doesn't work is because you only define r once and only for the active worksheet.


    Try defining it within the loop and by referencing the worksheet.

    Boo!:yikes:

  • Re: For each construct does not work


    Quote from norie

    The reason this doesn't work is because you only define r once and only for the active worksheet.


    Try defining it within the loop and by referencing the worksheet.


    Thank you Norie ...learnt a new thing today... :eureka: :thanx:

    .¸¸·´¯'·.¸¸.·´¯'·.¸¸·´¯'·.¸¸.·´¯'·.¸¸·´¯'·.¸¸.· ><((((º>

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!