PC Review


Reply
Thread Tools Rate Thread

Copy, Paste Special Values all sheets in workbook

 
 
sharon_hutchison@standardlife.com
Guest
Posts: n/a
 
      27th Sep 2007
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 With Quote
 
 
 
 
sali
Guest
Posts: n/a
 
      27th Sep 2007
of course, so you need to activate a sheet you want to deal with

<(E-Mail Removed)> je napisao u poruci interesnoj
grupi:(E-Mail Removed)...
> 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


 
Reply With Quote
 
sharon_hutchison@standardlife.com
Guest
Posts: n/a
 
      27th Sep 2007


Thanks very much, that worked a treat!

 
Reply With Quote
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      27th Sep 2007
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
>
> <(E-Mail Removed)> je napisao u poruci interesnoj
> grupi:(E-Mail Removed)...
> > 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
>
>
>

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      27th Sep 2007
See also
http://www.rondebruin.nl/values.htm

--

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


<(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Paste Special values for entire workbook Chris Maddogz Microsoft Excel Programming 7 28th May 2009 06:10 AM
Copy Paste Special Values Workbook =?Utf-8?B?UEpGcnk=?= Microsoft Excel Programming 2 17th Oct 2007 06:14 PM
copy all and paste values for all sheets in a workbook cass calculator Microsoft Excel Worksheet Functions 6 1st Jun 2007 02:58 PM
copy/paste values for all sheets in workbook cass calculator Microsoft Excel Programming 2 31st May 2007 11:36 PM
Dynamic Copy/Paste Special Formulas/Paste Special Values Sharon Perez Microsoft Excel Programming 3 7th Aug 2004 09:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:12 AM.