Alligatorwang
New Member
- Joined
- Jun 14, 2022
- Messages
- 3
- Office Version
- 2021
- 2013
- Platform
- MacOS
Hi, Please help me on this.
I have a already build up excel sheet from my professor, when I use window system everything runs fine, but I am using it on my mac computer and it just doesnot work and give me a really weird code: Named argument already specified.
I attached the code here:
I have a already build up excel sheet from my professor, when I use window system everything runs fine, but I am using it on my mac computer and it just doesnot work and give me a really weird code: Named argument already specified.
I attached the code here:
VBA Code:
Sub ARTable()
' Sorts ARs within section based on Annual Cost Savings
'Utility
Range("C14:F18").Sort _
Key1:=Range("E14:E18"), Order1:=xlDescending, Header:=xlNo, _
Key2:=Range("F14:F18"), Order2:=xlAscending, Header:=xlNo
'Lighting
Range("C21:F25").Sort _
Key1:=Range("E21:E25"), Order1:=xlDescending, Header:=xlNo, _
Key2:=Range("F21:F25"), Order2:=xlAscending, Header:=xlNo
'Motors
Range("C28:F32").Sort _
Key1:=Range("E28:E32"), Order1:=xlDescending, Header:=xlNo, _
Key2:=Range("F28:F32"), Order2:=xlAscending, Header:=xlNo
'Fluid Flow
Range("C35:F39").Sort _
Key1:=Range("E35:E39"), Order1:=xlDescending, Header:=xlNo, _
Key2:=Range("F35:F39"), Order2:=xlAscending, Header:=xlNo
'Compressed Air
Range("C42:F46").Sort _
Key1:=Range("E42:E46"), Order1:=xlDescending, Header:=xlNo, _
Key2:=Range("F42:F46"), Order2:=xlAscending, Header:=xlNo
'Steam
Range("C49:F53").Sort _
Key1:=Range("E49:E53"), Order1:=xlDescending, Header:=xlNo, _
Key2:=Range("F49:F53"), Order2:=xlAscending, Header:=xlNo
'Process Heating
Range("C56:F60").Sort _
Key1:=Range("E56:E60"), Order1:=xlDescending, Header:=xlNo, _
Key2:=Range("F56:F60"), Order2:=xlAscending, Header:=xlNo
'Process Cooling
Range("C63:F67").Sort _
Key1:=Range("E63:E67"), Order1:=xlDescending, Header:=xlNo, _
Key2:=Range("F63:F67"), Order2:=xlAscending, Header:=xlNo
'HVAC
Range("C70:F74").Sort _
Key1:=Range("E70:E74"), Order1:=xlDescending, Header:=xlNo, _
Key2:=Range("F70:F74"), Order2:=xlAscending, Header:=xlNo
'CHP
Range("C77:F81").Sort _
Key1:=Range("E77:E81"), Order1:=xlDescending, Header:=xlNo, _
Key2:=Range("F77:F81"), Order2:=xlAscending, Header:=xlNo
'Refrigeration
Range("C84:F88").Sort _
Key1:=Range("E84:E88"), Order1:=xlDescending, Header:=xlNo, _
Key2:=Range("F84:F88"), Order2:=xlAscending, Header:=xlNo
'Renewables
Range("C92:F96").Sort _
Key1:=Range("E92:E96"), Order1:=xlDescending, Header:=xlNo, _
Key2:=Range("F92:F96"), Order2:=xlAscending, Header:=xlNo
'End Sub
'Sub UpdateTable()
' Updates AR table - auto hides rows not needed and auto sizes row height
Sheets("AR List").Select
Application.ScreenUpdating = False
Application.Calculation = xlManual
Dim c As Range
For Each c In Range("B11:B96")
If c.Value = "" Then
c.EntireRow.Hidden = True
Else
c.EntireRow.Hidden = False
End If
Next c
Dim d As Range
For Each d In Range("B12, B19, B26, B33, B40, B47, B54, B61, B68, B75, B82, B90")
If d.Value = "" Then
d.EntireRow.Hidden = True
d.Offset(-1, 0).EntireRow.Hidden = True
d.Offset(5, 0).EntireRow.Hidden = True
Else
d.EntireRow.Hidden = False
d.Offset(-1, 0).EntireRow.Hidden = False
d.Offset(5, 0).EntireRow.Hidden = False
End If
Next d
Dim e As Range
For Each e In Range("B90")
If e.Value = "" Then
e.Offset(-2, 0).EntireRow.Hidden = True
Else
e.Offset(-2, 0).EntireRow.Hidden = False
End If
Next e
Application.Calculation = xlAutomatic
Application.ScreenUpdating = True
'Range("B11").Select
'ActiveCell.FormulaR1C1 = "=VLOOKUP(1,Inputs!R[-10]C[9]:RC[10],2,FALSE)"
'Range("B12").Select
End Sub
Last edited by a moderator: