Reference error

Lisa928

Board Regular
Joined
Jun 13, 2002
Messages
173
I have a spreadsheet that has the following information in column A. A simple calculation that I use as a line id.

A1 = 1
A2 = A1+1
A3 = A2+1
A4 = A3+1
A5 = A4+1

The problem is that this file is updated frequently and sometimes rows need to be removed. Is there any way through a formula (or VBA if not) that I can stop this from happening?
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

paliman

Active Member
Joined
Jul 7, 2002
Messages
255
I made this with the macro recorder. May be it needs some adjustments

Sub Macro2()

Range("A1").Select
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveCell.FormulaR1C1 = "=+R[-1]C+1"
Selection.Copy
Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
 

paliman

Active Member
Joined
Jul 7, 2002
Messages
255
The former code won't stop it from hapening, but it will update your formulas after deleting rows.
 

Forum statistics

Threads
1,181,334
Messages
5,929,372
Members
436,665
Latest member
MonkeyNotDonkey

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
Top