Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / May 2007

Tip: Looking for answers? Try searching our database.

copy/paste values for all sheets in workbook

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cass calculator - 31 May 2007 22:50 GMT
guys:

I have the code below to copy and paste all vales for all workbooks in
the active worksheet.  for some reason it doesn't do it for all sheets
though.  is there anything wrong with the code and/or a better way to
write this?

Thanks,

Joshua

Sub SheetCopyValues()
Application.ScreenUpdating = False

For i = 1 To ActiveWorkbook.Worksheets.Count

   Worksheets(i).Activate
   On Error Resume Next
   Cells.Activate
   Selection.Copy
   Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
   :=False, Transpose:=False
   Next i

Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
Norman Jones - 31 May 2007 23:08 GMT
Hi Joshua,

Try:

'=============>>
Public Sub SheetCopyValues()
   Dim WB As Workbook
   Dim SH As Worksheet

   Set WB = ActiveWorkbook

   For Each SH In WB.Worksheets
       With SH.UsedRange
           .Value = .Value
       End With
   Next SH
End Sub
'<<=============

---
Regards,
Norman

> guys:
>
[quoted text clipped - 24 lines]
> Application.ScreenUpdating = True
> End Sub
cass calculator - 31 May 2007 23:36 GMT
On May 31, 6:08 pm, "Norman Jones" <normanjo...@whereforartthou.com>
wrote:
> Hi Joshua,
>
[quoted text clipped - 47 lines]
> > Application.ScreenUpdating = True
> > End Sub

Alas, that is much smarter.  Thank you !
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.