Macro change formulas to values

ste33uka

Active Member
Joined
Jan 31, 2020
Messages
471
Office Version
  1. 365
Platform
  1. Windows
Hi i have a workbook with sheets names 1,2,3,4,5,67,8,9,10

Would anyone have a macro that would change the cells B2 to C10 and G2 to G20 from formulas into values ?
Thanks
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Try,

VBA Code:
Sub MakeValue()
    Dim i As Integer
    Dim cell As Range
    For i = 1 To 10
     For Each cell In Worksheets(CStr(i)).Range("B2:C10,G2:G20").Cells
        cell.Value = cell.Value
     Next cell
    Next i
End Sub

Dave
 
Upvote 0
Try,

VBA Code:
Sub MakeValue()
    Dim i As Integer
    Dim cell As Range
    For i = 1 To 10
     For Each cell In Worksheets(CStr(i)).Range("B2:C10,G2:G20").Cells
        cell.Value = cell.Value
     Next cell
    Next i
End Sub

Dave
Thanks alot, thats perfect
 
Upvote 0
Glad it worked

untested but another approach maybe

VBA Code:
Sub MakeValue()
    Dim i As Integer
    Dim Areas As Range
    For i = 1 To 10
     For Each Area In Worksheets(CStr(i)).Range("B2:C10,G2:G20").Areas
        Area.Value = Area.Value
     Next Area
    Next i
End Sub

Dave
 
Upvote 0

Forum statistics

Threads
1,214,423
Messages
6,119,398
Members
448,892
Latest member
amjad24

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