Hi Danial,

If you are not done with your task, you may want to consider this variation on 
Don's approach.   It's not thoroughly tested, but some of the changes should 
improve reliability.

 

The principle differences:

(1) Processes Areas (distinct ranges) containing formulas in each worksheet one 
at a time, rather than all at once.  Excel can corrupt your data (change it) in 
some cases without this change;

(2) Uses the Value2 property of formula ranges instead of the Value property.  
The Value property rounds off currency and date/time values to VBA Date and VBA 
Currency datatype limits, changing your underlying data.  Value2 is also faster;

(3) Only processes sheets in the Worksheets collection, skipping chart and 
legacy macro sheets;

(4) Loops through all open workbooks, prompting to process them (skipping 
hidden workbooks, but processing hidden sheets in workbooks with a visible 
window);

(5) If errors occur during processing you have the opportunity to continue 
processing anyway.

 

Sub ConvertToValues()

Dim wb As Workbook, ws As Worksheet, a As Range

Dim e As String, abort As Boolean

Const ProcTitle = "Convert to Values"

    On Error Resume Next

    Debug.Print vbCrLf & ProcTitle & " Start."

    For Each wb In Application.Workbooks

        If wb.Windows(1).Visible Then ' quick check to skip hidden workbooks 
(personal.xls*, addins,...)

            If MsgBox("Process " & wb.Name & "?", _

              vbQuestion + vbYesNo + vbDefaultButton2, _

              ProcTitle) = vbYes Then

                Debug.Print "Processing " & wb.FullName

                abort = False

                For Each ws In wb.Worksheets

                    Debug.Print , ws.Name

                    For Each a In 
ws.Cells.SpecialCells(xlCellTypeFormulas).Areas

ConvertValues:

                        If Not a Is Nothing Then

                            Debug.Print , , a.AddressLocal & " (" & 
a.Cells.Count & " cells)"

                            a.Value2 = a.Value2

                            If Err.Number <> 0 Then

                                e = "ERROR " & Err.Number & " - " & 
Err.Description

                                Err.Clear

                                Debug.Print e

                                Select Case _

                                  MsgBox(e & vbCrLf & vbCrLf & _

                                  "For processing of this workbook...", _

                                  vbQuestion + vbAbortRetryIgnore + 
vbDefaultButton3, _

                                  ProcTitle & " - [" & wb.Name & "]" & ws.Name 
& "!" & a.AddressLocal)

                                Case vbRetry

                                    Debug.Print "User retry."

                                    GoTo ConvertValues

                                Case vbAbort

                                    Debug.Print "User abort."

                                    abort = True

                                    Exit For

                                End Select

                            End If

                        End If

                    Next a

                    If abort Then Exit For

                Next ws

            Else

                Debug.Print "User skipped " & wb.FullName

            End If

        Else

            Debug.Print "Skipping hidden workbook " & wb.FullName

        End If

   Next wb

    Debug.Print vbCrLf & ProcTitle & " Finish."

Cleanup:

    Set a = Nothing

    Set ws = Nothing

    Set wb = Nothing

End Sub

 

Asa

 

From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] On 
Behalf Of dguillett1
Sent: Friday, February 03, 2012 8:12 AM
To: excel-macros@googlegroups.com
Subject: Re: $$Excel-Macros$$ paste special problem

 

Probably the most efficient to do only those with formulas

 

option explicit

Sub dovalues()

dim ws as worksheet

For Each ws In ActiveWorkbook.Sheets

With ws.Cells.SpecialCells(xlCellTypeFormulas)

  .value = .Value

End With

Next ws

End Sub

 

Don Guillett
SalesAid Software
dguille...@gmail.com

 

From: danial mansoor <mailto:danial_...@hotmail.com>  

Sent: Friday, February 03, 2012 9:38 AM

To: excel-macros@googlegroups.com 

Subject: $$Excel-Macros$$ paste special problem

 

i have a big file with many sheets i want to convert formula in values,if i do 
individually it will take lotes of time can any one tell me the macro which 
will work?

Note:macro should work fine in huge file i have a macro which is working fine 
with small file but not in huge file urgent help will be appreciated.




 

  _____  

Date: Thu, 2 Feb 2012 09:21:22 +0530
Subject: Re: $$Excel-Macros$$ $$Excel-Ma​cros$$ Index & Match Formula
From: vijayendrar...@gmail.com
To: excel-macros@googlegroups.com

Hi Sam,

 

Your formulas resolves my problem and thanks a lot for the same. Can you please 
let me know the logic behind of this formula.

 

Rohan,

I wanted to pick the employees name from the same project and Sam done it in 
right way.

 

Regards,

Vijayendra

2012/2/1 Sam Mathai Chacko <samde...@gmail.com>

Here's the result.

I have also sorted the list based on project. Please confirm if that is what 
you are looking for.

Regards,
Sam Mathai Chacko 

 

On Wed, Feb 1, 2012 at 8:53 PM, Vijayendra Rao <vijayendrar...@gmail.com> wrote:

Dear All,

 

I want to put index & match formula (or any other formula) in attached file, 
can you please help me to put the formula.

 

Excel file is attached along with email.

 

Regards,
Vijayendra
94491 67631


-- 
FORUM RULES (986+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5) Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 
 
NOTE : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.
 
------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com





-- 
Sam Mathai Chacko 



-- 
FORUM RULES (986+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5) Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 
 
NOTE : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.
 
------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com




-- 

ಧನ್ಯವಾದಗಳು,

ವಿಜಯೇಂದ್ರ,

೯೪೪೯೧ ೬೭೬೩೧

 

Regards,
Vijayendra
94491 67631



-- 
FORUM RULES (986+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5) Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 
 
NOTE : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.
 
------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

-- 
FORUM RULES (986+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5) Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 
 
NOTE : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.
 
------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

-- 
FORUM RULES (986+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5) Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 
 
NOTE : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.
 
------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

-- 
FORUM RULES (986+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

Reply via email to