(Some of) My Microsoft Excel Macros
created the simple way!
Sub insertsheets()            Return to top
'MacroName: insert12sheets
'MacroDescription: written by Merry Morris to insert 12 worksheets
        Sheets.Add Count:=12
End Sub
Sub adjustcolumnwidth()             Return to top
'MacroName: adjustcolumnwidth
'MacroDescription: created by Merry Morris to adjust column width
        Columns("A:L").Select
        Selection.COLUMNWIDTH = 10
        With Selection
              .HorizontalAlignment = xlCenter
        End With
End Sub
Sub CALENDARSHEETS()             Return to top
'MacroName: Insert 12 sheets in Fiscal Year order
'MacroDescription: written by Merry Morris to insert and name 12 worksheets for fiscal year statistics
        Sheets.Add.Name = "JUNE"
        Sheets.Add.Name = "MAY"
        Sheets.Add.Name = "APRIL"
        Sheets.Add.Name = "MARCH"
        Sheets.Add.Name = "FEBRUARY"
        Sheets.Add.Name = "JANUARY"
        Sheets.Add.Name = "DECEMBER"
        Sheets.Add.Name = "NOVEMBER"
        Sheets.Add.Name = "OCTOBER"
        Sheets.Add.Name = "SEPTEMBER"
        Sheets.Add.Name = "AUGUST"
        Sheets.Add.Name = "JULY"
End Sub
Sub CreateTable()             Return to top
'MacroName: createtable
'MacroDescription: written by Merry Morris to create a table with headings and borders
Range("A1:G1").Select
Selection.Font.Bold = True
With Selection.Font
          .Name = "Arial"
          .Size = 16
End With
With Selection
          .HorizontalAlignment = xlCenter
End With
Selection.Merge
ActiveCell.FormulaR1C1 = "Table Title Goes Here"
Range("A2").Select
With Selection
          .HorizontalAlignment = xlCenter
End With
ActiveCell.FormulaR1C1 = "CALL #"
Range("B2").Select
With Selection
          .HorizontalAlignment = xlCenter
End With
Range("B2").Select
ActiveCell.FormulaR1C1 = "AUTHOR"
Range("C2").Select
ActiveCell.FormulaR1C1 = "TITLE"
Range("C2").Select
With Selection
          .HorizontalAlignment = xlCenter
End With
Range("D2").Select
With Selection
          .HorizontalAlignment = xlCenter
End With
ActiveCell.FormulaR1C1 = "PUBLISHER"
Columns("D:D").EntireColumn.AutoFit
Range("E2").Select
With Selection
          .HorizontalAlignment = xlCenter
End With
ActiveCell.FormulaR1C1 = "ISBN#"
Range("F2").Select
With Selection
          .HorizontalAlignment = xlCenter
End Withv
ActiveCell.FormulaR1C1 = "OCLC#"
Range("G2").Select
With Selection
          .HorizontalAlignment = xlCenterv
End With
ActiveCell.FormulaR1C1 = "DATE"
Range("A1:G20").Select
With Selection.Borders(xlEdgeLeft)
          .LineStyle = xlContinuous
          .Weight = xlThick
End With
With Selection.Borders(xlEdgeTop)
          .LineStyle = xlContinuous
          .Weight = xlThick
End With
With Selection.Borders(xlEdgeBottom)
          .LineStyle = xlContinuous
          .Weight = xlThick
End With
With Selection.Borders(xlEdgeRight)
          .LineStyle = xlContinuous
          .Weight = xlThick
End With
With Selection.Borders(xlInsideVertical)
          .LineStyle = xlContinuous
          .Weight = xlMedium
End With
With Selection.Borders(xlInsideHorizontal)
          .LineStyle = xlContinuous
          .Weight = xlMedium
End With
End Sub
Sub freezepanes()             Return to top
'MacroName: freezepanes
'MacroDescription: written by Merry Morris to freeze panes above and/or to the left of selected cell
          ActiveWindow.freezepanes = True
End Sub
Sub printselection()             Return to top
'MacroName: printselection
'MacroDescription: written by Merry Morris to select area of worksheet and print selected area
          Range("A1:C30").Select
          Selection.PrintOut
End Sub
Sub printselection2()             Return to top
'MacroName: printselection2
'MacroDescription: written by Merry Morris to select area of worksheet (from user input box) and print selected area
Dim selectedarea As String
selectedarea = InputBox("Select Range","Enter range","A1:C30">
          Range(selectedarea).Select
          Selection.PrintOut
End Sub
Sub DeleteEntries()             Return to top
'MacroName: deleteentries
'MacroDescription: written by Merry Morris to select area of worksheet and delete all entries
Range("A1:I4").Select
          Selection.ClearContents
End Sub
Sub DeleteEntries2()             Return to top
'MacroName:deleteentries2
'MacroDescription: written by Merry Morris to select area of worksheet (with input box) and delete all entries
Dim selectedarea As String
          Range(selectedarea).Select
          Selection.ClearContents
End Sub
|