PC Review


Reply
Thread Tools Rate Thread

Best way to make all sheets in a workbook Values only

 
 
WhytheQ
Guest
Posts: n/a
 
      1st Jul 2011
Hello All,

I've come across a couple of methods of making all sheets in a
workbook values only. The routines I have have a tentency towards
unexpected errors and they take a while to run e.g below. Has anyone
got an alternative method I could try.

Any help appreciated
Jason.

'========================
Private Function MakeSheetValuesOnly(mySheetName As String)

With ActiveWorkbook.Sheets(mySheetName)
With .Cells
.Copy
.PasteSpecial xlPasteValues
End With
.Select
.Range("A1").Select
End With
ActiveWindow.SmallScroll Down:=-200
Application.CutCopyMode = False

End Function 'MakeSheetValuesOnly
'=========================================
 
Reply With Quote
 
 
 
 
Jim Cone
Guest
Posts: n/a
 
      1st Jul 2011
Private Function MakeSheetValuesOnlyR1(mySheetName As String) as Byte
On Error GoTo LowValue
With ActiveWorkbook.Sheets(mySheetName).UsedRange
On Error Resume Next
.Value = .Value
If Err.Number <> 0 Then
On Error GoTo LowValue
.Copy
.PasteSpecial xlPasteValues
Application.CutCopyMode = False
Else
On Error GoTo LowValue
End If
End With
ActiveWorkbook.Sheets(mySheetName).Select
ActiveWorkbook.Sheets(mySheetName).Range("A1").Select
Exit Function
LowValue:
Beep
End Function
'---

Jim Cone
Portland, Oregon USA
http://www.mediafire.com/PrimitiveSoftware
(XL Companion add-in: compares, matches, counts, lists, finds, deletes...)




"WhytheQ" <(E-Mail Removed)>
wrote in message
news:e9087cf9-1cf7-48f3-b99d-(E-Mail Removed)...
> Hello All,
>
> I've come across a couple of methods of making all sheets in a
> workbook values only. The routines I have have a tentency towards
> unexpected errors and they take a while to run e.g below. Has anyone
> got an alternative method I could try.
>
> Any help appreciated
> Jason.
>
> '========================
> Private Function MakeSheetValuesOnly(mySheetName As String)
>
> With ActiveWorkbook.Sheets(mySheetName)
> With .Cells
> .Copy
> .PasteSpecial xlPasteValues
> End With
> .Select
> .Range("A1").Select
> End With
> ActiveWindow.SmallScroll Down:=-200
> Application.CutCopyMode = False
>
> End Function 'MakeSheetValuesOnly
> '=========================================



 
Reply With Quote
 
GS
Guest
Posts: n/a
 
      1st Jul 2011
WhytheQ formulated the question :
> Hello All,
>
> I've come across a couple of methods of making all sheets in a
> workbook values only. The routines I have have a tentency towards
> unexpected errors and they take a while to run e.g below. Has anyone
> got an alternative method I could try.
>
> Any help appreciated
> Jason.
>
> '========================
> Private Function MakeSheetValuesOnly(mySheetName As String)
>
> With ActiveWorkbook.Sheets(mySheetName)
> With .Cells
> .Copy
> .PasteSpecial xlPasteValues
> End With
> .Select
> .Range("A1").Select
> End With
> ActiveWindow.SmallScroll Down:=-200
> Application.CutCopyMode = False
>
> End Function 'MakeSheetValuesOnly
> '=========================================


Try...

Sub MakeSheetValuesOnly2()
Dim wks As Worksheet
For Each wks In ActiveWorkbook.Worksheets
With wks.UsedRange
.Value = .Value
End With 'wks.UsedRange
Next 'wks
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


 
Reply With Quote
 
WhytheQ
Guest
Posts: n/a
 
      8th Jul 2011
this looks nice Garry - happy to avoid the clipboard - I'll give it a
go

J



On Jul 1, 5:21*pm, GS <g...@somewhere.net> wrote:
> WhytheQ formulated the question :
>
>
>
>
>
> > Hello All,

>
> > I've come across a couple of methods of making all sheets in a
> > workbook values only. The routines I have have a tentency towards
> > unexpected errors and they take a while to run e.g below. Has anyone
> > got an alternative method I could try.

>
> > Any help appreciated
> > Jason.

>
> > '========================
> > Private Function MakeSheetValuesOnly(mySheetName As String)

>
> > With ActiveWorkbook.Sheets(mySheetName)
> > * * * * With .Cells
> > * * * * * * .Copy
> > * * * * * * .PasteSpecial xlPasteValues
> > * * * * End With
> > * * * * .Select
> > * * * * .Range("A1").Select
> > End With
> > ActiveWindow.SmallScroll Down:=-200
> > Application.CutCopyMode = False

>
> > End Function * * * * * * * 'MakeSheetValuesOnly
> > '=========================================

>
> Try...
>
> Sub MakeSheetValuesOnly2()
> * Dim wks As Worksheet
> * For Each wks In ActiveWorkbook.Worksheets
> * * With wks.UsedRange
> * * * .Value = .Value
> * * End With 'wks.UsedRange
> * Next 'wks
> End Sub
>
> --
> Garry
>
> Free usenet access athttp://www.eternal-september.org
> ClassicVB Users Regroup! comp.lang.basic.visual.misc


 
Reply With Quote
 
Armando
Guest
Posts: n/a
 
      11th Jul 2011
On Jul 8, 5:54*am, WhytheQ <whyt...@gmail.com> wrote:
> this looks nice Garry - happy to avoid the clipboard - I'll give it a
> go
>
> J
>
> On Jul 1, 5:21*pm, GS <g...@somewhere.net> wrote:
>
>
>
> > WhytheQ formulated the question :

>
> > > Hello All,

>
> > > I've come across a couple of methods of making all sheets in a
> > > workbook values only. The routines I have have a tentency towards
> > > unexpected errors and they take a while to run e.g below. Has anyone
> > > got an alternative method I could try.

>
> > > Any help appreciated
> > > Jason.

>
> > > '========================
> > > Private Function MakeSheetValuesOnly(mySheetName As String)

>
> > > With ActiveWorkbook.Sheets(mySheetName)
> > > * * * * With .Cells
> > > * * * * * * .Copy
> > > * * * * * * .PasteSpecial xlPasteValues
> > > * * * * End With
> > > * * * * .Select
> > > * * * * .Range("A1").Select
> > > End With
> > > ActiveWindow.SmallScroll Down:=-200
> > > Application.CutCopyMode = False

>
> > > End Function * * * * * * * 'MakeSheetValuesOnly
> > > '=========================================

>
> > Try...

>
> > Sub MakeSheetValuesOnly2()
> > * Dim wks As Worksheet
> > * For Each wks In ActiveWorkbook.Worksheets
> > * * With wks.UsedRange
> > * * * .Value = .Value
> > * * End With 'wks.UsedRange
> > * Next 'wks
> > End Sub

>
> > --
> > Garry

>
> > Free usenet access athttp://www.eternal-september.org
> > ClassicVB Users Regroup! comp.lang.basic.visual.misc- Hide quoted text -

>
> - Show quoted text -


Try:
Sub Formula_Zapper()
Worksheets.Select
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues
ActiveSheet.Select
Application.CutCopyMode = False
End Sub
 
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
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
Comparing Cell values in two sheets within the same workbook amitmandalia@gmail.com Microsoft Excel Programming 10 16th Feb 2007 02:44 PM
copy sheets with values only and NO link to old workbook =?Utf-8?B?Um91bmR5?= Microsoft Excel Programming 1 11th May 2006 07:14 PM
How do I make changes in all sheets within a workbook? =?Utf-8?B?c2hmeg==?= Microsoft Excel Worksheet Functions 1 4th Aug 2005 03:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:56 AM.