1
votes

In excel 2016 on Mac, I'm attempting to save an individual sheet as a CSV in excel and I keep getting the

"Run-time error '424': Object required" error OR Run-time error: '1004'

I've searched long and hard, but simply cannot find an appropriate answer/fix:

Error line in bold

Sub AV_Guest_Macro() ' ' AV_Guest_Macro Macro

LastRow = Range("aa1").Value

'Copy Formulas

Range("L2:U2").Copy
Range("L3:U" & LastRow).Select
ActiveSheet.Paste


RowCheck = 2

Do Until RowCheck > LastRow

'Delete rows that have duplicate emails If Range("N" & RowCheck).Value = "Exclude" Then Range("X" & RowCheck).EntireRow.Delete

LastRow = LastRow - 1

Else 'this row will be imported
   RowCheck = RowCheck + 1

 End If

Loop

Application.DisplayAlerts = False

CurrentWorkbook.Sheets("Users").SaveAs Filename:= _ "\Users\Jhartley416\Desktop\JB_Test\AV_Users_Update_2016" _ , FileFormat:=6, CreateBackup:=False

Application.DisplayAlerts = True

ActiveWorkbook.Save
ActiveWorkbook.Close


Windows("AB JB Template - JLH2.xlsm").Activate
Sheets("Users").Activate

Sheets("Users").Range("A4:U10000").ClearContents
Range("A1").Select

End Sub

1
I'm using an older version of Excel but so maybe something changed but in my version you'd use ThisWorkbook not CurrentWorkbook. I don't see CurrentWorkbook declared anywhere. Do you have Option Explicit on?Sobigen

1 Answers

0
votes

The correct way to reference the selected workbook is ActiveWorkbook instead of CurrentWorkbook:

ActiveWorkbook.SaveAs Filename:= _ "\Users\Jhartley416\Desktop\JB_Test\AV_Users_Update_2016" _ , FileFormat:=6, CreateBackup:=False