Hi am new to vba. How to repeat the commands below and paste results in row C8, C9, etc. Thanks.
'
Sheets("Rand").Select
Range("A1").Select
Calculate
Range("A1:A8").Select
Selection.Copy
Range("A12").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveWorkbook.Worksheets("Rand").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Rand").Sort.SortFields.Add2 Key:=Range("A12:A19") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Rand").Sort
.SetRange Range("A12:A19")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Selection.Copy
Sheets("MLife").Select
Range("C7").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
'
Sheets("Rand").Select
Range("A1").Select
Calculate
Range("A1:A8").Select
Selection.Copy
Range("A12").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveWorkbook.Worksheets("Rand").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Rand").Sort.SortFields.Add2 Key:=Range("A12:A19") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Rand").Sort
.SetRange Range("A12:A19")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Selection.Copy
Sheets("MLife").Select
Range("C7").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True