Hi All, I have some code that is working fine on my computer (Office 365) but not on one of my colleague's, (Office 2016). I get a runtime error 438 on this code:
The error is in the last two lines. shRotMotPosition is the code name of the worksheet.
...any ideas?
VBA Code:
Sub RotMotPositionActual()
Application.EnableEvents = False
Application.ScreenUpdating = False
Dim lRow_shRotMotPosition As Long: lRow_shRotMotPosition = shRotMotPosition.Range("A" & Rows.Count).End(xlUp).Row + 1
shRotMotPosition.Range("A2:J" & lRow_shRotMotPosition).ClearContents
shLookup.Range("RotatorFullRange").Copy shRotMotPosition.Range("A2,C2,E2,G2,I2") 'set all rotator positions in shRotMotPosition
'copy Park data to shRotMotPosition
shRotMotPosition.Range("B2:B722").FormulaR1C1 = _
"=IF(ISERROR(VLOOKUP(RC[-1],ImportData!R2C2:R39C3,2,FALSE)),"""",VLOOKUP(RC[-1],ImportData!R2C2:R39C3,2,FALSE))"
shRotMotPosition.Range("B2:B722").Value = shRotMotPosition.Range("B2:B722").Value
shRotMotPosition.Range("A2") = Round(shDataImport.Range("B40"), 0)
shRotMotPosition.Range("A3:A722").FormulaR1C1 = "=IF(R[-1]C+1=720,1,R[-1]C+1)"
shRotMotPosition.Range("A3:A722").Value = shRotMotPosition.Range("A3:A722").Value
shRotMotPosition.Range("A2:A722").NumberFormat = "0"
shRotMotPosition.Sort.SortFields.Clear
shRotMotPosition.Sort.SortFields.Add2 _
Key:=Range("A1:A721"), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
...etc...
...any ideas?