VBA error 1004 Formula is missing a range or a defined name

zakasnak

Active Member
Joined
Sep 21, 2005
Messages
308
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
  2. MacOS
Good Morning!

I have vba that purges data for public posting, then saves each tab (named range) as a separate pdf to combine & post to the web. I'm getting a Run-time error '1004' "This formula is missing a range or a defined name" on Named Range(Table_7), on Tab "Table 7", when trying to save the tab to a pdf.

I tested the macro in the 1701 (January) through 1706 (June) files & it works, copied the macro to the 1707 (July), 1708 (August), 1709 (September), etc. files & it fails on Table_7.... same number of rows & columns in the named range.

When I take out the offending section, the macro works fine on all other pages... does anyone have any suggestions?

Code:
[CODE]    ActiveWorkbook.SaveAs filename:=ThisWorkbook.Path & "\" & Worksheets("Data Entry").Range("e14"), _
    FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
    Range("A1").Select
    Application.Goto Reference:="Cover"
    Selection.ExportAsFixedFormat Type:=xlTypePDF, filename:= _
        ThisWorkbook.Path & "\Cover.pdf", Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
        False
    Range("A1").Select
    Application.Goto Reference:="Table_8"
    Selection.ExportAsFixedFormat Type:=xlTypePDF, filename:= _
        ThisWorkbook.Path & "\8.pdf", Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
        False
    Range("A1").Select
[COLOR=#0000ff][B]    Application.Goto Reference:="Table_7"[/B][/COLOR]
[COLOR=#0000ff][B]    Selection.ExportAsFixedFormat Type:=xlTypePDF, filename:= _[/B][/COLOR]
[COLOR=#0000ff][B]        ThisWorkbook.Path & "\7.pdf", Quality:=xlQualityStandard, _[/B][/COLOR]
[COLOR=#0000ff][B]        IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _[/B][/COLOR]
[COLOR=#0000ff][B]        False[/B][/COLOR]
[COLOR=#0000ff][B]    Range("A1").Select[/B][/COLOR]
    Application.Goto Reference:="Table_6"
    Selection.ExportAsFixedFormat Type:=xlTypePDF, filename:= _
        ThisWorkbook.Path & "\6.pdf", Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
        False
    Range("A1").Select
    Application.Goto Reference:="Table_5"
    Selection.ExportAsFixedFormat Type:=xlTypePDF, filename:= _
        ThisWorkbook.Path & "\5.pdf", Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
        False
    Range("A1").Select
    Application.Goto Reference:="Table_4"
    Selection.ExportAsFixedFormat Type:=xlTypePDF, filename:= _
        ThisWorkbook.Path & "\4.pdf", Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
        False
    Range("A1").Select
    Application.Goto Reference:="Table_3"
    Selection.ExportAsFixedFormat Type:=xlTypePDF, filename:= _
        ThisWorkbook.Path & "\3.pdf", Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
        False
    Range("A1").Select
    Application.Goto Reference:="Table_2"
    Selection.ExportAsFixedFormat Type:=xlTypePDF, filename:= _
        ThisWorkbook.Path & "\2.pdf", Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
        False
    Range("A1").Select
    Application.Goto Reference:="Table_1"
    Selection.ExportAsFixedFormat Type:=xlTypePDF, filename:= _
        ThisWorkbook.Path & "\1.pdf", Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
        False
        Range("A1").Select
        Sheets("Data Entry").Select
    Range("C4").Select    
End Sub
[/CODE]
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
SOLVED: VBA error 1004 Formula is missing a range or a defined name

The named range Table_7 scope was set to Table_7, not workbook.

Copied the range,
Deleted the range,
Created new range, using copied data
Named it the same,
Edit the scope to WORKBOOK!

WAHOO!
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top