macro to flatten worksheets?

bluepenink

Well-known Member
Joined
Dec 21, 2010
Messages
585
Hello

I have a workbook with over 30 worksheets; i dont want to individually paste special > values for all......is there a macro that can be provided? i appreciate it. thank you.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
For Each wks In Worksheets
wks.UsedRange.Value = wks.UsedRange.Value
Next
 
Upvote 0
hello

my copy/paste special range is A1:X200 and that can be applied to all worksheets....im very new with excel so can you kindly assist me further? thxs
 
Upvote 0
Code:
Sub Flatten()

Dim ws As Worksheet

Application.ScreenUpdating = False

For Each ws In ThisWorkbook.Worksheets
    With ws.UsedRange
        .Copy
        .PasteSpecial xlValues
    End With
    
Next ws

Application.CutCopyMode = False

Application.ScreenUpdating = True

End Sub
 
Upvote 0
hello

my copy/paste special range is A1:X200 and that can be applied to all worksheets....im very new with excel so can you kindly assist me further? thxs

My code will work perfectly well ... did you even try it?
 
Upvote 0

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

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