Jagwarman
asked on
find text insert row and colour row
Can an expert assist me with this please.
I need to find the last occurrence of the word Past in column AQ then insert a blank row beneath the last occurrence and then colour the row from A:AQ Yellow.
thanks in advance
I need to find the last occurrence of the word Past in column AQ then insert a blank row beneath the last occurrence and then colour the row from A:AQ Yellow.
thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
brilliant thanks
From the OP in private mail
Unfortunately I never gave it a thought that if the Macro does not find "Past" it would fall over which it does. Can you help me out. I would be happy to repost so that you can get the point if you want me to.
set rngpast = Range("AQ:AQ").Find("Past" , Range("AQ" & Rows.Count), , xlWhole, , xlPrevious).EntireRow
if not rngpast is nothing then
rngpast.Offset(1).Insert
rngpast.Offset(1).Resize(, 43).Interior.Color = RGB(255, 255, 0)
End if
if not rngpast is nothing then
rngpast.Offset(1).Insert
rngpast.Offset(1).Resize(,
End if
ASKER
Many thanks apologies for being a nuisance.
ASKER
I don't believe it I am now getting
Object variable or With block variable not set
Object variable or With block variable not set
Try
set rngpast = Range("AQ:AQ").Find("Past" , Range("AQ" & Rows.Count), , xlWhole, , xlPrevious)
if not rngpast is nothing then
set rngpast=rngpast.EntireRow
rngpast.Offset(1).Insert
rngpast.Offset(1).Resize(, 43).Interior.Color = RGB(255, 255, 0)
End if
set rngpast = Range("AQ:AQ").Find("Past"
if not rngpast is nothing then
set rngpast=rngpast.EntireRow
rngpast.Offset(1).Insert
rngpast.Offset(1).Resize(,
End if
ASKER
wow don't you sleep?
that's great that works
Many thanks
that's great that works
Many thanks
Range("AQ:AQ").Find("Past"
********Edited******