Avoid !REF Errors

Sandy Radjenovic

Board Regular
Joined
Nov 4, 2003
Messages
76
I'm just not catching on with avoiding the #REF error. I realize why I am getting it but getting around it seems to be a problem.

I have formulas in columns that reference the columns above it. When I delete a row, the row below and thereafter contain #REF error because the referenced cell no longer exists.

My spreadsheet is as follows ...

Column P = date time ie P7=01/10/2004 7:00:00 am
Column N = hours needed ie N8=3.0
P8=01/10/2004 10:00:00 am

This is a schedule which calculates time periods. My formula (p8=P7+N8/24) is inserted via VBA

Range("P" & r).Formula = "=P" & r - 1 & " + N" & r & "/ 24"

for rows 7 thru last row.

How can I update this formula so that a deleted row does not result in references to no longer existent cells and #REF errors?

Totally struggling here and would appreciate any insight whatsoever!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Sandy Radjenovic

Board Regular
Joined
Nov 4, 2003
Messages
76
You are so wonderful! I have been playing with the offset command for some time and, obviously, never came up with the correct syntax!
 
Upvote 0

Forum statistics

Threads
1,186,905
Messages
5,960,508
Members
438,481
Latest member
KBChristensen

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