REF Error

Chris Mcarthur

New Member
Joined
Jan 30, 2019
Messages
16
On sheets 1 through 30 representing each day of the month I have data that I would like to transfer to the Summary sheet.
so for example I have '1'!A2 as a formula on the summary sheet and when i type it in, it seems to work but when I delete out all the data on sheet '1' and copy and paste the new information into when a new month begins, I get a REf error on my Summary sheet.why wont it pick up what is still in cell A2 on Sheet '1'?
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Welcome to the Board!

How exactly are you deleting the data?
If you are deleting rows, you will mess up your row reference formulas. It would be better to simply clear the data instead of deleting the rows (highlight all the data and hit the Delete button on your keyboard).

Otherwise, you would need to change yoru reference formula, maybe introduce INDIRECT.

Note that you can also use an Excel macro to easily and quickly clear all the data out of all the sheets at once.
 
Upvote 0
Welcome to the Board!

How exactly are you deleting the data?
If you are deleting rows, you will mess up your row reference formulas. It would be better to simply clear the data instead of deleting the rows (highlight all the data and hit the Delete button on your keyboard).

Otherwise, you would need to change yoru reference formula, maybe introduce INDIRECT.

Note that you can also use an Excel macro to easily and quickly clear all the data out of all the sheets at once.

Hi thanks for that, I did try the delete on the keyboard but it keeps the formatting in place. can you tell me more about the Macro method?
 
Upvote 0
Hi thanks for that, I did try the delete on the keyboard but it keeps the formatting in place.

Yes, it will only clear the data, not the formatting, though we may be able to clear the formatting too.
What kind of formatting are we talking about?

can you tell me more about the Macro method?
Are all the sheets basically structured the same way?
What rows/columns are populated?
Are there any completely blank rows in the middle of your data or not?
Are there are header rows that you do NOT want cleared?
 
Last edited:
Upvote 0

Yes, it will only clear the data, not the formatting, though we may be able to clear the formatting too.
What kind of formatting are we talking about?


Are all the sheets basically structured the same way?
What rows/columns are populated?
Are there any completely blank rows in the middle of your data or not?
Are there are header rows that you do NOT want cleared?

The formatting is fill color, etc that wont be the same from month to month, based on employees off, sick, etc..

Yes all the sheets are structured the same way with title/headers in place, 5 columns but i only am transferring only column A and E date to the summary sheet... no completely blank rows are copied and pasted in.
 
Upvote 0
What I am trying to get a picture of is which rows/cells need to be cleared.
Is it every row on each page (except the Summary page), except row 1?
Or are there multiple header rows to leave?
 
Upvote 0
What I am trying to get a picture of is which rows/cells need to be cleared.
Is it every row on each page (except the Summary page), except row 1?
Or are there multiple header rows to leave?

Yes every row is cleared except for the 1st row.
 
Upvote 0
The following code will clear all data and color formatting out of every sheet not named "Summary", and will leave the headers in row 1.
Code:
Sub MyMacro()

    Dim ws As Worksheet
    Dim rng As Range
    
    Application.ScreenUpdating = False

'   Loop through all worksheets
    For Each ws In Worksheets
'       Skip summary sheet
        If ws.Name <> "Summary" Then
'           Select range to be current region except for first row
            Set rng = ws.Range("A1").CurrentRegion.Offset(1, 0)
'           Clear range
            rng.ClearContents
'           Clear color formatting in range
            With rng.Interior
                .Pattern = xlNone
                .TintAndShade = 0
                .PatternTintAndShade = 0
            End With
        End If
    Next ws
    
    Application.ScreenUpdating = True
    
End Sub
 
Upvote 0
You are welcome.
Hope that helps to simplify and streamline things for you!
:)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,021
Latest member
Mohamed Magdi Tawfiq Emam

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