LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Macro: Paste Values

For Each wks In ActiveWorkbook.Worksheets
With wks.Range(sAddr)
.Value = .Value
End With
Next wks


Is the part that pasted the values. And you'll notice that it did the work for
each worksheet in the activeworkbook.

If you had sheets that had formulas in that range's address, then they got
converted to values, too. Double check your workbook before you save it!

If you don't want all the worksheets, you can group the sheets first (click on
the first tab and ctrl-click on subsequent tabs).

But change the code in the macro to just process the selected sheets:

for each wks in activewindow.selectedsheets

Remember to ungroup the worksheets when you're done.

Jennifer wrote:

This works great! Thanks so much.

One question:
As far as I can tell it did the paste values into all the correct
worksheets. Can you explain to me how (or which part of the code) did this?
This sounds a little ambiguous, I mean that there are worksheets I didn't
want to do the paste special and the code seemed to do that. Can you explain?

"Dave Peterson" wrote:

Option Explicit
Sub ValuesOnly2()

Dim sAddr As String
Dim wks As Worksheet

sAddr = ""
On Error Resume Next
sAddr = Application.InputBox(Prompt:="Select the formulas", _
Title:="VALUES ONLY", Type:=8).Address
On Error GoTo 0

If sAddr = "" Then
Exit Sub
End If

For Each wks In ActiveWorkbook.Worksheets
With wks.Range(sAddr)
.Value = .Value
End With
Next wks

End Sub


Jennifer wrote:

I'm using this macro to make one column values only:
Sub ValuesOnly( )

Dim rRange As Range

On Error Resume Next

Set rRange = Application.InputBox(Prompt:="Select the formulas",
Title:="VALUES ONLY", Type:=8)

If rRange Is Nothing Then Exit Sub

rRange = rRange.Value

End Sub

This works great for one worksheet but how do I apply it to several
worksheets? The column that I'm select to paste values only is the same for
each worksheet.

Basically I would like to select a range of cells and have it apply to that
same range of cells for every worksheet.


--

Dave Peterson


--

Dave Peterson


 
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
Paste values - macro yshridhar Excel Discussion (Misc queries) 4 March 25th 08 06:36 AM
A macro to paste values Matthew Excel Discussion (Misc queries) 2 September 17th 07 10:25 AM
Paste Values Macro John Calder New Users to Excel 4 May 28th 07 10:19 PM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


All times are GMT +1. The time now is 11:43 PM.

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"