Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel 2010 code wont copy/paste to values

I have used code like the following for many years to remove all the
formulas from multiple worksheets.

Sub Convert2Values()
Sheets(Array("Cover", "Comments", "Month", "YTD", "Analysis",
"Cost Per Car")). _
Select
Sheets("Cover").Activate
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub

The code still works as a stand-alone macro. However, when I place
the place the code into another Excel macro, it will only convert the
first page ("Cover") to values.

Do anyone have any ideas what is going on? I was previously using
Excel 2003 and the code worked fine.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Excel 2010 code wont copy/paste to values

jaxgab wrote on 2/16/2011 :
I have used code like the following for many years to remove all the
formulas from multiple worksheets.

Sub Convert2Values()
Sheets(Array("Cover", "Comments", "Month", "YTD", "Analysis",
"Cost Per Car")). _
Select
Sheets("Cover").Activate
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub

The code still works as a stand-alone macro. However, when I place
the place the code into another Excel macro, it will only convert the
first page ("Cover") to values.

Do anyone have any ideas what is going on? I was previously using
Excel 2003 and the code worked fine.


I'm thinking it has to do with the difference in the number of
rows/cols being too many to fit memory. I suggest you iterate the array
and use UsedRange to set .Value=.Value.

--
Garry

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Excel 2010 code wont copy/paste to values

Here's what works for me:

Sub CopyRangeValues_AllSheets()
Dim sh As Variant

For Each sh In Split("Cover,Comments,Month,YTD,Analysis,Cost Per
Car", ",")
With Sheets(sh).UsedRange
.Value = .Value
End With
Next
End Sub

--
Garry

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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Excel 2010 code wont copy/paste to values

On Feb 16, 3:40*pm, jaxgab wrote:
I have used code like the following for many years to remove all the
formulas from multiple worksheets.

Sub Convert2Values()
* * Sheets(Array("Cover", "Comments", "Month", "YTD", "Analysis",
"Cost Per Car")). _
* * * * Select
* * Sheets("Cover").Activate
* * Cells.Select
* * Selection.Copy
* * Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
* * * * :=False, Transpose:=False
End Sub

The code still works as a stand-alone macro. *However, when I place
the place the code into another Excel macro, it will only convert the
first page ("Cover") to values.

Do anyone have any ideas what is going on? *I was previously using
Excel 2003 and the code worked fine.


I bet you wish Lotus 3 DOS was still around - you could address the
"cube" directly and Clear it or Copy to it.

Excel is a pizza menu, whereas Lotus DOS was the Encyclopaedia
Britannica :)
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
Add "paste values" to right-click shortcut menu-how do? Excel 2010 Chet Excel Programming 1 June 27th 10 11:23 PM
Copy/Paste Values code Jules Excel Programming 12 March 3rd 10 05:37 AM
VBA code to copy and paste by values from one Excel workbook to another Nhien Excel Programming 7 August 17th 07 04:06 PM
Combobox Code, Wont Copy and paste? MelissaDeMille Excel Programming 3 April 18th 07 08:36 PM
For dates, copy/paste special/values for 2006 gives me 2010--Why geraldjoh Excel Worksheet Functions 3 July 23rd 06 01:12 AM


All times are GMT +1. The time now is 09:42 AM.

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

About Us

"It's about Microsoft Excel"