ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Locate and Format Row Macro (https://www.excelbanter.com/excel-programming/363967-locate-format-row-macro.html)

ksp

Locate and Format Row Macro
 

Hi All

I need some help with a macro to locate the first occurance of text i
a list so that I can then select that row and format it ie like a min
heading

Here's an example:

My range (a named range called WIP_Area) goes from A12:K12 and the
down, in column A there is a list of text that has the followin
categories: Incoming, Work in Progress, On Hold and Other. The rows ar
sorted so that each category is grouped. I want to locate the firs
occurance of each of these categories in column A (however a categor
may not appear at all), then select the range A:K for that row so tha
I can then apply a fill / shading to the range.

I am sure that this is quite simple when you know how

Any help would be appreciated

Thanks

KS

--
ks
-----------------------------------------------------------------------
ksp's Profile: http://www.excelforum.com/member.php...nfo&userid=626
View this thread: http://www.excelforum.com/showthread.php?threadid=55088


Executor

Locate and Format Row Macro
 
Hi ksp

This should do the trick

Public Sub MarkCategory()
Dim lRow As Long

lRow = 13
Do While Not IsEmpty(Cells(lRow, 1))
If Cells(lRow, 1).Value < Cells(lRow - 1, 1) Then
With Range("A" & lRow & ":K" & lRow)
.Interior.ColorIndex = 4
End With
End If
lRow = lRow + 1
Loop
End Sub

HTH,

Executor


ksp wrote:
Hi All

I need some help with a macro to locate the first occurance of text in
a list so that I can then select that row and format it ie like a mini
heading

Here's an example:

My range (a named range called WIP_Area) goes from A12:K12 and then
down, in column A there is a list of text that has the following
categories: Incoming, Work in Progress, On Hold and Other. The rows are
sorted so that each category is grouped. I want to locate the first
occurance of each of these categories in column A (however a category
may not appear at all), then select the range A:K for that row so that
I can then apply a fill / shading to the range.

I am sure that this is quite simple when you know how

Any help would be appreciated

Thanks

KSP


--
ksp
------------------------------------------------------------------------
ksp's Profile: http://www.excelforum.com/member.php...fo&userid=6267
View this thread: http://www.excelforum.com/showthread...hreadid=550885



ksp

Locate and Format Row Macro
 

Thank-you

Yes it works perfectly

Much Appreciated

KS

--
ks
-----------------------------------------------------------------------
ksp's Profile: http://www.excelforum.com/member.php...nfo&userid=626
View this thread: http://www.excelforum.com/showthread.php?threadid=55088



All times are GMT +1. The time now is 09:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com