Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Copy, Paste Special Values all sheets in workbook

I'd like to write a macro that goes to each sheet in turn, selects all
cells and paste special values. I've got his far but it only seems to
work for the active sheet:

Sub removelinks()
Dim wks As Worksheet
Dim wb As Workbook
Set wb = ThisWorkbook


For Each wks In wb.Worksheets

Cells.Select
Cells.Copy
Cells.PasteSpecial Paste:=xlValues

Next

End Sub

Any help appreciated....thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Copy, Paste Special Values all sheets in workbook

of course, so you need to activate a sheet you want to deal with

je napisao u poruci interesnoj
roups.com...
I'd like to write a macro that goes to each sheet in turn, selects all
cells and paste special values. I've got his far but it only seems to
work for the active sheet:

Sub removelinks()
Dim wks As Worksheet
Dim wb As Workbook
Set wb = ThisWorkbook


For Each wks In wb.Worksheets


'---------- add next line after for each
wks.activate


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Copy, Paste Special Values all sheets in workbook



Thanks very much, that worked a treat!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Copy, Paste Special Values all sheets in workbook

You don't need to select. Use this instead.

Sub removelinks()
Dim wks As Worksheet
Dim wb As Workbook
Set wb = ThisWorkbook

For Each wks In wb.Worksheets

wks.Cells.Copy
wks.Cells.PasteSpecial Paste:=xlValues

Next

End Sub


"sali" wrote:

of course, so you need to activate a sheet you want to deal with

je napisao u poruci interesnoj
roups.com...
I'd like to write a macro that goes to each sheet in turn, selects all
cells and paste special values. I've got his far but it only seems to
work for the active sheet:

Sub removelinks()
Dim wks As Worksheet
Dim wb As Workbook
Set wb = ThisWorkbook


For Each wks In wb.Worksheets


'---------- add next line after for each
wks.activate



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Copy, Paste Special Values all sheets in workbook

See also
http://www.rondebruin.nl/values.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


wrote in message oups.com...
I'd like to write a macro that goes to each sheet in turn, selects all
cells and paste special values. I've got his far but it only seems to
work for the active sheet:

Sub removelinks()
Dim wks As Worksheet
Dim wb As Workbook
Set wb = ThisWorkbook


For Each wks In wb.Worksheets

Cells.Select
Cells.Copy
Cells.PasteSpecial Paste:=xlValues

Next

End Sub

Any help appreciated....thanks

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy all and paste values for all sheets in a workbook cass calculator Excel Worksheet Functions 6 June 1st 07 02:58 PM
copy/paste values for all sheets in workbook cass calculator Excel Programming 2 May 31st 07 11:36 PM
Copy & Paste Special Using Values Paul Black Excel Programming 5 November 29th 06 04:35 AM
copy paste special values mike allen[_2_] Excel Programming 7 October 12th 05 06:06 PM
Dynamic Copy/Paste Special Formulas/Paste Special Values Sharon Perez Excel Programming 3 August 7th 04 09:49 PM


All times are GMT +1. The time now is 07:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"