PDA

View Full Version : Solved: format row with random selection



Spratt_Cary
01-22-2008, 11:15 AM
Hi All, have not been here for awhile. But need to be able to select a random row and apply specific formatting. (Attached spreadsheet example below) Right now I have it set up to Click "Add section" and it add a row and then formats the row. But I really need to be able to select any random row and then click "Add section" and it would format the selected row. Any help for me on this one out there. Thanks in advance.

Paul_Hossler
01-22-2008, 05:38 PM
Maybe something like this



Option Explicit
Sub Add_Sec()

If Not TypeOf Selection Is Range Then Exit Sub

With Selection.Rows(1).EntireRow
.Cells(1).Value = "Section"

With .Cells(1).Resize(1, 3).Interior
.ColorIndex = 8
.Pattern = xlSolid
End With

With .Cells(4).Resize(1, 7).Interior
.ColorIndex = 48
.Pattern = xlSolid
End With

End With
End Sub


Paul

Spratt_Cary
01-22-2008, 05:52 PM
Perfect, you guys are so cool. thanks a mil.