copy and paste special

bonovox1

Board Regular
Joined
Aug 11, 2007
Messages
91
hi i have a macro that i run after i run this macro i have to copy and paste the 3 sheets of my file. Could somebody suggest code that could do this in the macro itself.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Lewiy

Well-known Member
Joined
Jan 5, 2007
Messages
4,284
Which sheets do you want to copy and where do you want to paste them?
 
Upvote 0

bonovox1

Board Regular
Joined
Aug 11, 2007
Messages
91
After i run the macro i copy and paste special values on all 3 sheets in the file. Simply i want to copy and paste special values on each sheet using vba code instead of having to do it manually after the macro has run.
 
Upvote 0

Lewiy

Well-known Member
Joined
Jan 5, 2007
Messages
4,284
Try this:
Code:
Dim wb As Workbook
Dim sh As Worksheet
Set wb = ThisWorkbook
For Each sh In wb.Worksheets
    sh.UsedRange.Value = sh.UsedRange.Value
Next sh
 
Upvote 0

bonovox1

Board Regular
Joined
Aug 11, 2007
Messages
91
hi, i tried this but the macro runs perfectly but it doesn`t copy and paste special values at the end. Any ideas?
 
Upvote 0

Lewiy

Well-known Member
Joined
Jan 5, 2007
Messages
4,284
Just to make sure it’s definitely running the code, try this:
Code:
Dim wb As Workbook
Dim sh As Worksheet
Set wb = ThisWorkbook
For Each sh In wb.Worksheets
    MsgBox sh.Name
    sh.UsedRange.Value = sh.UsedRange.Value
Next sh

You should get a box pop up with the name of each sheet as it does the conversion.
 
Upvote 0

Forum statistics

Threads
1,191,419
Messages
5,986,454
Members
440,031
Latest member
davidvillegasr

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
Top