Macros Runtime Error

questforexcel

Board Regular
Joined
Jan 18, 2019
Messages
128
Office Version
  1. 2013
Platform
  1. Windows
Hi,

I have been trying to run macros from my source file to run on my target file.

I even selected use "relative reference", however every time I start to work on my file it gives me a runtime error code 1004. I understand that is because it cannot source the reference data. When I debug, it opens VBA and higlights the cells in blue below.

Could you please help and guide on whats wrong with my code and Macros.

I am fairly new with it, it doesnt appear to be as simple as clicking a "start" recording and "stop" recording macro.

End With
ActiveCell.Offset(2, 0).Rows("1:4").EntireRow.Select
Selection.Delete Shift:=xlUp
ActiveCell.Offset(-2, 0).Rows("1:5").EntireRow.Select
ActiveCell.Offset(-2, 9).Range("A1").Activate
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
What is the active cell to start with?
If it's in row1 or 2 you will get an error
 
Upvote 0
Hi,

The active cells were in Row 2. Is there a set defined number of rows columns which should be left while working on Macros.

Thank you

What is the active cell to start with?
If it's in row1 or 2 you will get an error
 
Upvote 0
With your code after the rows are deleted rows 4:7 will be selected
The next line will select rows 2:6
& the final line will try to move up 2 rows taking you to row 0 which doesn't exist.
What are you trying to do?
 
Upvote 0

Forum statistics

Threads
1,223,954
Messages
6,175,601
Members
452,658
Latest member
GStorm

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