.Value = .Value (error) (Reading data from one workbook and populating in another)

agohir

New Member
Joined
Aug 5, 2016
Messages
14
Hello Excel Community,

I am trying to hardcode each worksheet in a workbook. I have the following code that gives an "Overflow" error when I run it on .Value = .Value

Any help with the code please:

Dim ws As Worksheet

For Each ws In ActiveWorkbook.Worksheets
With ws.UsedRange
.Value = .Value

End With
Next ws

The error I receive is on .Value = .Value
Is there a way I can hardcode worksheets using a different code. I tried copy paste special but the result was "true" filled in all cells.

Please help.

Thanks for the help.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Try this:

Code:
Sub Do_All()
Application.ScreenUpdating = False
Dim i As Long
    For i = 1 To Sheets.Count
        With Sheets(i).UsedRange
            .Value = .Value
        End With
    Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0
I have the following code that gives an "Overflow" error when I run it on .Value = .Value

Definitely an overflow error, and not an out of memory error?

If so, I suggest you check for cells that look like this: ############## which are dates/times that are negative or too big.

It looks like over-large dates are the problem, e.g. if A1 contains 9999999 formatted as a date, then this line of code will give you an overflow error:

Range("A1").Value = Range("A1").Value
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,623
Latest member
Techenthusiast

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