Home OS Windows How do I fix Runtime Error 1004 in Microsoft Excel?

How do I fix Runtime Error 1004 in Microsoft Excel?

Microsoft Excel is among the hottest spreadsheets used throughout the globe for each particular person and enterprise functions. It is the one-stop vacation spot for storing, organizing, and manipulating information in an organized method. MS Excel comes primarily in two extensions i.e. XLS and XLSX format. However, other than its unimaginable recognition, runtime errors are a typical nuisance for an incredible many Windows customers – and one of the crucial widespread ones is the Runtime Error 1004.

Runtime Error 1004 in Excel

In this information, we’re going to talk about this widespread Runtime Error 1004 and among the finest fixes to resolve it effortlessly.

What is Runtime Error 1004 in Excel?

Runtime error 1004 is an error code regarding Microsoft Visual Basic that has been recognized to disturb Microsoft Excel customers. This error is confronted by any variations of MS Excel corresponding to Excel 2007, 2010, 2013, 2016, 2019 as effectively. No model of Microsoft Excel is protected from the menace of Runtime Error 1004.

This error is especially encountered by customers whereas they’re engaged on an excel file or making an attempt to generate a Macro within the excel doc. It could cause severe bother whereas working with Visual Basic Applications and might fully crash a program, and even your complete system; typically it might freeze the system prohibiting the customers to do something on their system.

Types of error message

The error messages which are most related to this runtime error are as follows:

  • VB: run-time error ‘1004’: Application-defined or object-defined error
  • Excel VBA Runtime error 1004 “Select method of Range class failed”
  • runtime error 1004 technique vary of object _global failed visible fundamental
  • Excel macro “Run-time error ‘1004?
  • Runtime error 1004 method open of object workbooks failed
  • Run-Time error ‘1004’: Method ‘Ranger’ of Object’ Worksheet’ Failed
  • “Method in Key up Object Program APPLICATION Failed.”

If you encounter any of those above errors, then you possibly can repair the error utilizing our information.

What are the causes?

The Error 1004 is a common code associated to MS Excel however isn’t particular to at least one actual trigger. Hence, on this case, the precise motive why this error would possibly pop up will differ from case to case and circumstance to circumstance. From configuration points to software program issues, beneath we listed a synopsis of widespread causes for runtime error 1004 in excel:

  • MS Excel Desktop Icon is perhaps corrupted
  • VBA Excel File is clashing with different software
  • Due to software or object specified error
  • Due to lacking dependent file
  • Due to Virus, Trojan or malware
  • Due to Invalid Registry Keys and so forth.

These had been a couple of of the most typical causes behind getting the runtime error 1004 in MS Excel; now allow us to perceive the completely different fixes.

Fix Runtime Error 1004 in Excel

Here we’ve detailed each guide and computerized options to repair the Runtime Error 1004. You can observe any one of many subsequent strategies to resolve the difficulty.

  1. Create a brand new Excel template
  2. Run a Virus Scan
  3. For VB: run-time error ‘1004’, resize legend entries

Let’s have a look at every of those strategies intimately.

1] Create a brand new Excel template

In some circumstances, fixing this situation could be so simple as inserting a brand new worksheet from a template as a substitute of making a duplicate of an current worksheet. Here is what it is advisable to do:

1] Open MS Excel in your system

2] Press ‘CTRL + N’ to create a brand new Microsoft Excel worksheet or just choose a ‘Blank workbook’ from the primary display screen.

3] Once achieved delete all of the sheets on the workbook besides one.

4] Now, format the workbook, which has been left. Also, notice, this workbook could be modified to fit your particular person want.

5] In the top, go to ‘File > Save As’ to save lots of the brand new worksheet with the Excel Template (.xltx or .xlt) file format.

6] Once you’ve efficiently created the template, you possibly can insert it programmatically through the use of the next line of code:

Sheets.Add Type:=pathfilename

Please notice – Do not neglect to switch the brand new filename with the precise title of the doc.

2] Run a Virus Scan

It is essential to scan your pc system for malware and viruses as these can corrupt information and necessary paperwork and present the runtime error 1004 in MS Excel. Sometimes utilizing a superb antivirus program helps quite a bit.

3] For VB: run-time error ‘1004’, resize legend entries

If you come throughout a Runtime Error 1004 when working a Microsoft Visual Basic for Applications (VBA) macro, then you need to use this technique to work-around.

Generally, you get this error whenever you attempt to run a VBA macro that makes use of the LegendEntries technique to make adjustments to legend entries in a Microsoft Excel chart. That time, you might obtain the next error message:

Run-time error ‘1004’: Application or object-defined error

This error happens when the Excel chart incorporates extra legend entries than there’s house accessible to show the legend entries on the Excel chart. When this conduct happens, Microsoft Excel could truncate the legend entries.

To work round this conduct, create a macro that reduces the font dimension of the Excel chart legend textual content earlier than your VBA macro makes adjustments to the chart legend after which restore the font dimension of the chart legend in order that it’s much like the next macro instance.

Sub ResizeLegendEntries()
With Worksheets("Sheet1").ChartObjects(1).Activate
      ' Store the present font dimension
      fntSZ = ActiveChart.Legend.Font.Size
'Temporarily change the font dimension.
      ActiveChart.Legend.Font.Size = 2
'Place your LegendEntries macro code right here to make
         'the adjustments that you simply wish to the chart legend.
' Restore the font dimension.
      ActiveChart.Legend.Font.Size = fntSZ
   End With
End Sub

We hope this text helps you repair the runtime error 1004 in Microsoft Excel. This information provides you guide in addition to computerized resolution to eliminate this error; you may make use of any resolution based mostly in your want.

Read subsequent: Arrows keys not working in Microsoft Excel.

Most Popular

Recent Comments