Results 1 to 9 of 9

Removing formulas in all sheets by Paste/Special

Threaded View

  1. #1
    Registered User
    Join Date
    03-06-2008
    Posts
    8

    Removing formulas in all sheets by Paste/Special

    Hi,

    I have written a short piece of code based on some other posts and for some reason it doesn't work and it's driving me mad. The task seems to be very easy - I'm trying to get rid of some formulas in all worksheets and keep the actual values only. The part that is failing is the following: ws.Range("A1:P31").Select

    Sub CopyPasteSpecialAllSheets()
        Dim ws As Worksheet
        Application.ScreenUpdating = False
        
        For Each ws In Worksheets
        
        ws.Range("A1:P31").Select
        Selection.Copy
        Selection.PasteSpecial Paste:=xlPasteValues
        Application.CutCopyMode = False
    
        Next ws
    End Sub
    When I take out "ws" from ws.Range("A1:P31").Select then the code works fine, but it doesn't loop through all worksheets - it executes 78 times the code on the active worksheet....

    Any ideas on how to fix it and why this happens?
    Last edited by kapiszon2929; 10-06-2008 at 05:54 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Help with code that creates formulas on new sheets
    By westonkw in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-01-2008, 10:41 AM
  2. Nested formula's, data from 2 sheets.....
    By gurj_sandhu in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-12-2008, 10:41 AM
  3. Using cell names on multiple sheets for formulas
    By cardigans1 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-21-2008, 12:34 PM
  4. Replies: 7
    Last Post: 06-17-2007, 04:23 PM
  5. combining multiple sheets & removing blank lines
    By rosemwd in forum Excel General
    Replies: 0
    Last Post: 12-04-2006, 12:00 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1