• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member
You are here: Home
Lost password?
sp_Search
Advanced Search
Advanced Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search

Please confirm you want to mark all posts read

Mark all topics read

sp_MobileMenu Actions
Actions
sp_LogInOut
Log In
sp_Search

Search Forums

sp_RankInfo
Ranks Information
Avatar

New/Updated Topics

General Excel Questions & Answers

  Amortization

  Customer Order From Facebook Page.

  Grey out master list when selected in dropdown

Dashboards & Charts

  Connecting 2 separate pivot charts or data sets to calculate…

VBA & Macros

  Send Email Code Error

  Direccionar de un rango a una celda especifica

  how can i add windows media player in excel 2016

  Changing shape colours

Power Query

  Unpivoting data

Power Query

  pq_7.01_parameter_tables

Power BI

  How identify the URL to connect power bi with Project online

Excel Expert

  new and deleted entries

  Excel Dashboard

Select Forum

  Rules and Guides

Forum Rules and Guides

  Public Forums - For Registered Users

General Excel Questions & Answers

Dashboards & Charts

VBA & Macros

Power Query

Power Pivot

  Course Members Only

Excel Dashboards

Power Query

Power Pivot

Xtreme Pivot Tables

Excel for Decision Making

Excel for Finance

Power BI

Excel

Word

Outlook

Excel Expert

Excel for Customer Service Professionals

Excel Analysis Toolpak

Excel Tables

Excel for Operations Management

Financial Modelling

Advanced Excel Formulas

Pivot Tables Quick Start

ForumsVBA & Macros
sp_TopicIcon
Invalid Forward Reference
Avatar
Preston Haralson
Posts: 1

Level 0
April 12, 2022 - 8:43 am

1

I have a code that I use to "clean up" a workbook that I use for work. I've been using it for years and all of a sudden I got a Run Time Error. I'm not sure if it's something that I did or a software update. Any help would be appreciated as I'm not very proficient at vba code. The error is highlighted in red below, according to excel.

 

The error is as follows:

Run-time error '-2147319767 (80028029)

Automation error

Invalid forward reference, or reference to uncompiled type.

 

Code being used:

CleanUp Macro

Dim answer As Integer

answer = MsgBox("WARNING!" & vbLf & "This will clear all data." & vbLf & "Continue?", _

vbExclamation + vbYesNo, _

"WARNING - This will clear data")

If answer = vbNo Then Exit Sub

Sheet3.Select

Range("B1").Select

Application.CutCopyMode = False

Selection.Copy

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _

:=False, Transpose:=False

ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True

Range("B5").Select

Sheet1.Select

Cells.Select

Application.CutCopyMode = False

Selection.Copy

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _

:=False, Transpose:=False

Rows("31:31").Select

Range(Selection, Selection.End(xlDown)).Select

Application.CutCopyMode = False

Selection.Delete Shift:=xlUp

Range("B5").Select

Sheet6.Select

ActiveWindow.SelectedSheets.Delete

Sheet1.Activate

Avatar
Velouria
London or thereabouts
Posts: 613

Level 4
April 12, 2022 - 10:52 pm

2

Generally when I've seen this nonsensical error, the solution involves doing something to force a recompile of the VBA project. For example, add a new reference (using Tools-References in the VB Editor), then save, close and re-open the workbook. If that fixes it, you can usually remove the reference you added and save again.

Avatar
Kathy Christensen
Posts: 1

Level 0
June 23, 2022 - 9:16 am

3

@Velouria: Thanks so much! I had a similar error and your solution worked.  I had spent two full days trying to trouble-shoot.

Avatar
Velouria
London or thereabouts
Posts: 613

Level 4
June 23, 2022 - 6:06 pm

4

Hi Kathy,

 

Glad it was useful to you. 🙂

Forum Timezone:
Australia/Brisbane
Most Users Ever Online: 245
Currently Online: baber Tufail
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)

Devices in use: Desktop (6), Phone (5)

Forum Stats:
Groups: 3
Forums: 24
Topics: 6205
Posts: 27211
Member Stats:
Guest Posters: 49
Members: 31880
Moderators: 3
Admins: 4
© Simple:Press

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.