Results 1 to 5 of 5

How to insert rows between locations

Threaded View

  1. #1
    Registered User
    Join Date
    10-14-2010
    Location
    WI
    MS-Off Ver
    Excel 2007
    Posts
    77

    How to insert rows between locations

    Hello again,
    I am looking to add to my already created macro. This Macro is just strictly for formating a report I run daily to look pretty. I need it to insert a row based on groups of locations in Column F.

    I will attach an example of my report and below is my current code.

    Sub InspectionMacro()
    '
    ' InspectionMacro Macro
    ' Make the spread sheet pretty.
    '
    ' Keyboard Shortcut: Ctrl+e
    '
        Range("A2").Select
        ActiveCell.FormulaR1C1 = "=TODAY()"
        Selection.Copy
        Range("A3:A68").Select
        ActiveSheet.Paste
        ActiveWindow.SmallScroll Down:=-12
        Range("I2").Select
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = ""
        Columns("F:F").Select
        Selection.Delete Shift:=xlToLeft
        Range("A2").Select
        With ActiveWindow
            .SplitColumn = 0
            .SplitRow = 1
        End With
        ActiveWindow.FreezePanes = True
        Rows("1:1").Select
        Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
        Range("G2").Select
        ActiveCell.FormulaR1C1 = "Phone call made to:"
        Range("H2").Select
        ActiveCell.FormulaR1C1 = "Date-Time"
        Range("I2").Select
        ActiveCell.FormulaR1C1 = "Comments"
        Range("J2").Select
        ActiveCell.FormulaR1C1 = "Follow up email sent"
        Cells.Replace What:="'", Replacement:="", LookAt:=xlPart, SearchOrder:= _
            xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
        Cells.Select
        With Selection
            .HorizontalAlignment = xlLeft
            .VerticalAlignment = xlBottom
            .WrapText = False
            .Orientation = 0
            .AddIndent = False
            .IndentLevel = 0
            .ShrinkToFit = False
            .ReadingOrder = xlContext
            .MergeCells = False
        End With
        Selection.Columns.AutoFit
        Range("A1:J1").Select
        With Selection
            .HorizontalAlignment = xlCenter
            .VerticalAlignment = xlBottom
            .WrapText = False
            .Orientation = 0
            .AddIndent = False
            .IndentLevel = 0
            .ShrinkToFit = False
            .ReadingOrder = xlContext
            .MergeCells = False
        End With
        Selection.Merge
        ActiveCell.FormulaR1C1 = "Inspections Not Done - Vehicle Currently Driving"
        Rows("1:2").Select
        Selection.Font.Bold = True
        Range("G3").Select
    End Sub
    Attached Files Attached Files
    Last edited by TWent; 10-19-2010 at 12:37 PM.

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