I
ineedhelp2
Below is my code, I hope someone can help me edit it. Also I am having
the following problems:
-Keyboard shortcut is not working
-I also do not want the excel windows (info windows saying things like
looking for the header row) to not show up. Thanks!
Code:
--------------------
Sub NewMo()
'
' NewMo Macro
'
' Keyboard Shortcut: Ctrl+z
'
Range("C2").Select
Selection.EntireColumn.Insert
ActiveCell.FormulaR1C1 = "=REPLACE(RC[1],3,4,"""")"
Range("C3").Select
ActiveWindow.SmallScroll ToRight:=1
Range("M2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-1]=""-"",(RC[-2]*-1),RC[-2])"
Range("M2").Select
Selection.AutoFill Destination:=Range("M2:M500"), Type:=xlFillDefault
Range("M2:M500").Select
ActiveWindow.ScrollRow = 1
ActiveWindow.ScrollColumn = 1
Range("C2").Select
Selection.AutoFill Destination:=Range("C2:C500"), Type:=xlFillDefault
Range("C2:C500").Select
ActiveWindow.ScrollRow = 1
Range("A2").Select
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Range("A3:M3").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Range("A3").Select
ActiveCell.FormulaR1C1 = "FUND"
Range("B3").Select
ActiveCell.FormulaR1C1 = "CENTER"
Range("C3").Select
ActiveCell.FormulaR1C1 = "DEPT/CHAR"
Range("D3").Select
ActiveCell.FormulaR1C1 = "ACCOUNT"
Range("E3").Select
ActiveCell.FormulaR1C1 = "DESC"
Range("F3").Select
ActiveCell.FormulaR1C1 = "Revised Budget"
Range("G3").Select
ActiveCell.FormulaR1C1 = "Current Mo"
Range("H3").Select
ActiveCell.FormulaR1C1 = "YTD"
Range("I3").Select
ActiveCell.FormulaR1C1 = "Encum"
Range("J3").Select
ActiveCell.FormulaR1C1 = "Comm"
Range("K3").Select
ActiveCell.FormulaR1C1 = "Avail Balance"
Range("A4").Select
ActiveWindow.SmallScroll ToRight:=3
Range("M3").Select
ActiveCell.FormulaR1C1 = "Avail Balance"
Range("M4").Select
ActiveWindow.ScrollColumn = 1
Range("A3").Select
Selection.Sort Key1:=Range("B4"), Order1:=xlAscending, Key2:=Range("C4") _
, Order2:=xlAscending, Header:=xlYes, OrderCustom:=1, MatchCase:=False _
, Orientation:=xlTopToBottom
Selection.Subtotal GroupBy:=3, Function:=xlSum, TotalList:=Array(6, 7, 8, 9, _
10, 13), Replace:=True, PageBreaks:=False, SummaryBelowData:=False
Range("A4:M636").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=RIGHT($C1,8)=""Total"""
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
End With
Selection.FormatConditions(1).Interior.ColorIndex = 15
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 1
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=RIGHT($A1,8)=""Total"""
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
End With
Selection.FormatConditions(1).Interior.ColorIndex = 15
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=RIGHT($A4,8)=""Total"""
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
End With
Selection.FormatConditions(1).Interior.ColorIndex = 15
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=RIGHT($C4,8)=""Total"""
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
End With
Selection.FormatConditions(1).Interior.ColorIndex = 15
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=RIGHT($C4,5)=""Total"""
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
End With
Selection.FormatConditions(1).Interior.ColorIndex = 15
Rows("3:3").Select
Selection.Font.Bold = True
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = True
.MergeCells = Falseb
End With
End Sub
the following problems:
-Keyboard shortcut is not working
-I also do not want the excel windows (info windows saying things like
looking for the header row) to not show up. Thanks!
Code:
--------------------
Sub NewMo()
'
' NewMo Macro
'
' Keyboard Shortcut: Ctrl+z
'
Range("C2").Select
Selection.EntireColumn.Insert
ActiveCell.FormulaR1C1 = "=REPLACE(RC[1],3,4,"""")"
Range("C3").Select
ActiveWindow.SmallScroll ToRight:=1
Range("M2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-1]=""-"",(RC[-2]*-1),RC[-2])"
Range("M2").Select
Selection.AutoFill Destination:=Range("M2:M500"), Type:=xlFillDefault
Range("M2:M500").Select
ActiveWindow.ScrollRow = 1
ActiveWindow.ScrollColumn = 1
Range("C2").Select
Selection.AutoFill Destination:=Range("C2:C500"), Type:=xlFillDefault
Range("C2:C500").Select
ActiveWindow.ScrollRow = 1
Range("A2").Select
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Range("A3:M3").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Range("A3").Select
ActiveCell.FormulaR1C1 = "FUND"
Range("B3").Select
ActiveCell.FormulaR1C1 = "CENTER"
Range("C3").Select
ActiveCell.FormulaR1C1 = "DEPT/CHAR"
Range("D3").Select
ActiveCell.FormulaR1C1 = "ACCOUNT"
Range("E3").Select
ActiveCell.FormulaR1C1 = "DESC"
Range("F3").Select
ActiveCell.FormulaR1C1 = "Revised Budget"
Range("G3").Select
ActiveCell.FormulaR1C1 = "Current Mo"
Range("H3").Select
ActiveCell.FormulaR1C1 = "YTD"
Range("I3").Select
ActiveCell.FormulaR1C1 = "Encum"
Range("J3").Select
ActiveCell.FormulaR1C1 = "Comm"
Range("K3").Select
ActiveCell.FormulaR1C1 = "Avail Balance"
Range("A4").Select
ActiveWindow.SmallScroll ToRight:=3
Range("M3").Select
ActiveCell.FormulaR1C1 = "Avail Balance"
Range("M4").Select
ActiveWindow.ScrollColumn = 1
Range("A3").Select
Selection.Sort Key1:=Range("B4"), Order1:=xlAscending, Key2:=Range("C4") _
, Order2:=xlAscending, Header:=xlYes, OrderCustom:=1, MatchCase:=False _
, Orientation:=xlTopToBottom
Selection.Subtotal GroupBy:=3, Function:=xlSum, TotalList:=Array(6, 7, 8, 9, _
10, 13), Replace:=True, PageBreaks:=False, SummaryBelowData:=False
Range("A4:M636").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=RIGHT($C1,8)=""Total"""
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
End With
Selection.FormatConditions(1).Interior.ColorIndex = 15
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 1
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=RIGHT($A1,8)=""Total"""
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
End With
Selection.FormatConditions(1).Interior.ColorIndex = 15
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=RIGHT($A4,8)=""Total"""
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
End With
Selection.FormatConditions(1).Interior.ColorIndex = 15
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=RIGHT($C4,8)=""Total"""
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
End With
Selection.FormatConditions(1).Interior.ColorIndex = 15
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=RIGHT($C4,5)=""Total"""
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
End With
Selection.FormatConditions(1).Interior.ColorIndex = 15
Rows("3:3").Select
Selection.Font.Bold = True
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = True
.MergeCells = Falseb
End With
End Sub