See if this modification to Jacob's code does what you want...
Sub HighlightSections()
Dim lngRow As Long
Dim lngLastRow As Long
Dim lngLastCol As Long
Dim varAccNumber As Variant
lngLastRow = Cells(Rows.Count, "A").End(xlUp).Row
lngLastCol = Cells.Find(What:="*", SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious).Column
varAccNumber = Range("A" & lngLastRow)
For lngRow = lngLastRow To 2 Step -1
If varAccNumber < Range("A" & lngRow) Then
varAccNumber = Range("A" & lngRow)
lngRow = lngRow + 1
Rows(lngRow).Insert
Range(Range("A" & lngRow), Cells(lngRow, lngLastCol)). _
Interior.Color = vbYellow
End If
Next
End Sub
--
Rick (MVP - Excel)
"Laura1 via OfficeKB.com" <u31091@uwe wrote in message
news:957ba31de2726@uwe...
Yes this is exactly what I wanted thank you!!!!! The only thing if
possible
can I get the hightlight to be the length of the entire row with data?
NOT a big deal I can live with the other too!!!
Thank you! So very much!
Jacob Skaria wrote:
Assuming you have continuous sorted account numbers in ColA with headers
in
Row1 ; run the below macro to insert a blank row after each section and
highlight colA to ColC of the blank row inserted. Please try and feedback
If you are new to macros launch VBE using Alt+F11. Insert module and paste
the below code. Save. Close VBE. Get back to workbook. From tools macro
run
the below macro. In 2007 uner View menu |View Macros
Sub HighlightSections()
Dim lngRow As Long
Dim lngLastRow As Long
Dim varAccNumber As Variant
lngLastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
varAccNumber = Range("A" & lngLastRow)
For lngRow = lngLastRow To 2 Step -1
If varAccNumber < Range("A" & lngRow) Then
varAccNumber = Range("A" & lngRow)
lngRow = lngRow + 1
Rows(lngRow).Insert
Range("A" & lngRow & ":C" & lngRow).Interior.Color = vbYellow
End If
Next
End Sub
If this post helps click Yes
---------------
Jacob Skaria
Hi: I am trying to format an excel worksheet based on acount number
changing
[quoted text clipped - 12 lines]
5678 12/31/2009 4.59
hightlight here
--
Message posted via http://www.officekb.com