Consulting

Results 1 to 3 of 3

Thread: Solved: format row with random selection

  1. #1

    Solved: format row with random selection

    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.

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,730
    Location
    Maybe something like this


    [VBA]
    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
    [/VBA]

    Paul

  3. #3
    Perfect, you guys are so cool. thanks a mil.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •