View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Joel Mills Joel Mills is offline
external usenet poster
 
Posts: 79
Default Help Simplifing Code

The code below works, but I'm sure it can be simplified. Any help would be
appreciated. Am using this project to help me learn VBA.


Sub Populate_Charts()
'This Populates the Chart with the Week Ending Dates from the Pivot Table
Worksheets("Pivot").Activate
Range("B4").Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Copy
Worksheets("Charts").Activate
Range("C25").PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Rows("25:25").Select
Selection.NumberFormat = "d-mmm-yy"
'This Populates the Chart with Average Planned Manpower
Worksheets("Pivot").Activate
Range("B10").Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Copy
Worksheets("Charts").Activate
Range("C26").PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Selection.NumberFormat = "#,##0.0"
Worksheets("Pivot").Activate
Range("B5:B5").Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Copy
Worksheets("Charts").Activate
Range("C28:C28").PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Selection.NumberFormat = "0.0%"
Worksheets("Pivot").Activate
Range("B6:B6").Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Copy
Worksheets("Charts").Activate
Range("C29:C29").PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Selection.NumberFormat = "0.0%"
ActiveCell.CurrentRegion.Select
Selection.Borders(xlEdgeLeft).Weight = xlThin
Selection.Borders(xlEdgeRight).Weight = xlThin
Selection.Borders(xlEdgeTop).Weight = xlThin
Selection.Borders(xlEdgeBottom).Weight = xlThin
Selection.Borders(xlInsideHorizontal).Weight = xlThin
Selection.Borders(xlInsideVertical).Weight = xlThin
End Sub