have this data on a spreadsheet which I format with a recorded macro but Both the rows and columns change frequently everyday and the macro only works for the cells I recorded . How Do I create a dynamic range and loop the formula to customize the newer and additional rows and columns
i.e add more rows for more teams and for the rest of the month.
the Rows are
Jan 1 Jan 2 Jan 3
Concorde Score 160 160 80
Total 0 134 63
%age 0 0.8375 0.7875
Victoria 120 100 50
i.e add more rows for more teams and for the rest of the month.
the Rows are
Jan 1 Jan 2 Jan 3
Concorde Score 160 160 80
Total 0 134 63
%age 0 0.8375 0.7875
Victoria 120 100 50
Code:
Sub Test3w()
'
' Test3w Macro
'
'
Columns("A:A").Select
Selection.Delete Shift:=xlToLeft
Range("A4").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Rows("3:4").Select
Range("A4").Activate
Selection.Delete Shift:=xlUp
Columns("C:C").Select
Selection.Delete Shift:=xlToLeft
Range("B5").Select
ActiveCell.FormulaR1C1 = ""
Range("B3").Select
ActiveCell.FormulaR1C1 = "Score"
Range("B4").Select
ActiveCell.FormulaR1C1 = "T"
Range("B4:C5").Select
ActiveCell.FormulaR1C1 = "Total "
Range("B5").Select
ActiveCell.FormulaR1C1 = "%age"
Range("C5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-2]C=0,""no Score"",R[-1]C/R[-2]C)"
Range("C5").Select
Selection.AutoFill Destination:=Range("C5:E5"), Type:=xlFillDefault
Range("C5:E5").Select
Range("C5").Select
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween, _
Formula1:="=0", Formula2:="=0.5"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Color = -16383844
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 13551615
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Range("C5:E5").Select
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween, _
Formula1:="=0.05", Formula2:="=0.001"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Color = -16752384
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 13561798
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Range("C5:E5").Select
Selection.Copy
Range("C21:E21,C9:E9,C13:E13,C17:E17,C25:E25").Select
Range("C25").Activate
ActiveWindow.ScrollRow = 2
ActiveWindow.ScrollRow = 5
ActiveWindow.ScrollRow = 7
ActiveWindow.ScrollRow = 9
ActiveWindow.ScrollRow = 12
ActiveWindow.ScrollRow = 13
ActiveWindow.ScrollRow = 15
ActiveWindow.ScrollRow = 17
ActiveWindow.ScrollRow = 19
ActiveWindow.ScrollRow = 20
ActiveWindow.ScrollRow = 21
ActiveWindow.ScrollRow = 22
ActiveWindow.ScrollRow = 23
Range( _
"C21:E21,C9:E9,C13:E13,C17:E17,C25:E25,C29:E29,C33:E33,C37:E37,C41:E41,C45:E45,C49:E49" _
).Select
Range("C49").Activate
ActiveWindow.SmallScroll Down:=-18
Selection.PasteSpecial Paste:=xlPasteFormulasAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=-3
End Sub