Results 1 to 4 of 4

Runtime error '1004' on one sheet while trying to change formulas to values

Threaded View

  1. #1
    Registered User
    Join Date
    06-04-2019
    Location
    U.S.
    MS-Off Ver
    2016
    Posts
    48

    Runtime error '1004' on one sheet while trying to change formulas to values

    Good morning all!!

    I'm trying to loop through all the worksheets in a workbook changing all the formulas to values. This works for 93 out of the 94 sheets in the workbook, but for some reason I am getting a runtime error '1004' application defined or object defined error on the 94th worksheet. I have no clue why. My code looks like this:

    Sub swapValues()
    
    Dim i As Long
    Dim ws_num As Long
    Dim starting_ws As Worksheet
    
    Set starting_ws = ActiveSheet
    ws_num = ThisWorkbook.Worksheets.Count
    
    For i = 1 To ws_num
    
        ThisWorkbook.Worksheets(i).Activate
        
        With ActiveSheet.Range("A1:CZ300")
        
            .Value = .Value
            
        End With
        
    Next i
    
    starting_ws.Activate
    
    End Sub
    It does get halfway through the sheet turning formulas to values before stopping. When I get the error, it highlights the line .Value = .Value. Any help would be appreciated.

    Dome
    Last edited by BrokenDome; 06-27-2019 at 09:55 AM. Reason: Change info

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Runtime error 1004 when searching for either of two values
    By Ochimus in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-28-2019, 07:08 AM
  2. [SOLVED] GetSaveAsFilename - change file type, runtime error 1004
    By TC1980 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-12-2017, 07:11 AM
  3. [SOLVED] Formulas in VBA runtime Error 1004
    By shogunatwork in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-04-2017, 10:41 AM
  4. [SOLVED] Copying a sheet into same workbook - runtime error 1004.
    By russwongg in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-03-2017, 11:19 AM
  5. sheet protect runtime error 1004
    By aussietom in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-23-2013, 09:07 AM
  6. Runtime Error 1004 when concatenating numeric values into string
    By spokok in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-20-2013, 04:33 PM
  7. Copy sheet from another workbook - runtime error 1004
    By larne in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-28-2010, 05:45 AM

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