+ Reply to Thread
Results 1 to 3 of 3

Need to set a row height in my code. But how?

  1. #1
    Registered User
    Join Date
    08-31-2009
    Location
    washington, dc
    MS-Off Ver
    Excel 2003
    Posts
    55

    Need to set a row height in my code. But how?

    Hello,

    The following code Looks for the value "PR Block" in column B and inserts a a gray row above each of these cell values. I was wondering how i can set the row height of these newly inserted rows to 15. Any ideas?


    Sub Insert_Row()
    Dim lRow As Long, nxtRow As Long, ColCnt As Long, a As Long
    Dim MySheets As Variant
    MySheets = Array("FY09 Installation Support", "FY09 Install", "FY09 Purchase", "FY09 CF Discretionary Grants", "FY09 CF LOI", "FY08 Purchase", "FY08 Installation Support", "FY08 CF Discretionary Grants", "FY07 Sup Install Support", "FY07 CF Install Non-LOI", "FY07 Sup Purchase", "FY05 CF Carryover Install", "FY04 Recovery Funds", "FY05 Recovery Funds", "FY08 Safety Carryover", "FY09 Safety", "FY09 Transport Canada")
    Application.ScreenUpdating = False
    For a = LBound(MySheets) To UBound(MySheets)
    With Worksheets(MySheets(a))
    ColCnt = .Columns.Count
    lRow = .Range("B" & .Rows.Count).End(xlUp).Row
    For nxtRow = lRow To 1 Step -1
    If .Range("B" & nxtRow) = "PR Block" Then
    .Range("B" & nxtRow).EntireRow.Insert
    With .Range("B" & nxtRow).EntireRow.Interior
    .ColorIndex = 16
    .Pattern = xlSolid
    End With
    .Range(.Cells(nxtRow, 1), .Cells(nxtRow, ColCnt)).BorderAround ColorIndex:=0, Weight:=xlMedium
    End If
    Next nxtRow
    End With
    Next a
    Application.ScreenUpdating = True
    End Sub


    As always, thank you very much for the help.
    Last edited by copleyr; 09-03-2009 at 09:12 AM.

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Need to set a row height in my code. But how?

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-31-2009
    Location
    washington, dc
    MS-Off Ver
    Excel 2003
    Posts
    55

    Re: Need to set a row height in my code. But how?

    worked perfectly thank you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1