Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 "cass calculator" wrote in message ps.com... 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On May 31, 6:08 pm, "Norman Jones"
wrote: 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 "cass calculator" wrote in message ps.com... 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 Alas, that is much smarter. Thank you ! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy Paste Values - Entire Workbook and Save | Excel Discussion (Misc queries) | |||
copy all and paste values for all sheets in a workbook | Excel Worksheet Functions | |||
copy sheets with values only and NO link to old workbook | Excel Programming | |||
Macro to open workbook and copy and paste values in to orig workbo | Excel Worksheet Functions |