I created this macro by recording. I selected all sheets and the code shows 13 sheets. So I can only use this macro with 13 sheets. I would like to be able to use it for any amount of sheets.
All help is much appreciated
All help is much appreciated
Code:
Sub FindDistance()
'
' FindDistance Macro
'
'
Range("E1").Select
Sheets(Array("Sheet13", "Sheet12", "Sheet11", "Sheet10", "Sheet9", "Sheet8", "Sheet7" _
, "Sheet6", "Sheet5", "Sheet4", "Sheet3", "Sheet2", "Sheet1")).Select
Sheets("Sheet13").Activate
Range("E1").Select
ActiveCell.FormulaR1C1 = _
"=6371*ACOS(COS(RADIANS(90-RC[-4]))*COS(RADIANS(90-RC[-2]))+SIN(RADIANS(90-RC[-4]))*SIN(RADIANS(90-RC[-2]))*COS(RADIANS(RC[-3]-RC[-1])))/1.609"
Range("E1").Select
Selection.AutoFill Destination:=Range("E1:E60195")
Range("E1:E60195").Select
End Sub