+ Reply to Thread
Results 1 to 7 of 7

For Each In ThisWorkbook.Worksheets failing to apply to all sheets

  1. #1
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    For Each In ThisWorkbook.Worksheets failing to apply to all sheets

    So, I'm using the following piece of code from Ron de Bruin to change my formulas into values in all sheets. I am using a Select as I have some pivots and it throws an error on .Value=.Value syntax.
    The strangest thing is that is not applying to all sheets. Basically, it works on all of them except for last 6 out of 20.
    There is no error at all, the code works, but doesn't change into values.

    I hope someone has an idea as why, as I spent the last few hours to fix it without success.

    Please Login or Register  to view this content.
    Click the * to say thanks.

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,908

    Re: For Each In ThisWorkbook.Worksheets failing to apply to all sheets

    I can't see anything wrong with that code. I don't follow your comment about Selecting because of pivot tables - how are the two related?
    Rory

  3. #3
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: For Each In ThisWorkbook.Worksheets failing to apply to all sheets

    I don't see anything wrong either. If I am using the following code instead it throws an error on pivots. I was just trying to explain the choice of code
    Please Login or Register  to view this content.
    But the problem still occurs. The last 6 sheets are not changed to values, the formulas are in place.

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,908

    Re: For Each In ThisWorkbook.Worksheets failing to apply to all sheets

    You can still copy/paste without selecting.

    Do you see all the sheets being selected in turn?

  5. #5
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: For Each In ThisWorkbook.Worksheets failing to apply to all sheets

    I think I found out the reason. So in these sheets I have some filtered out rows using a formula. I also have some columns/rows grouped. I don't think that the grouped ranges are causing problems, but maybe the filtered rows are. But there is no error. How comes?

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,908

    Re: For Each In ThisWorkbook.Worksheets failing to apply to all sheets

    Do you have any error handling in your code?

  7. #7
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: For Each In ThisWorkbook.Worksheets failing to apply to all sheets

    None. But I kinda solved the issue. I added an autofilter line and now it works smothly. Still don't understand why it didn't threw an error but at least I managed to fix it.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Google Sheets onEdit Script Failing On Mobile
    By swordswinger710 in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 0
    Last Post: 10-11-2019, 12:21 PM
  2. [SOLVED] For...next and thisworkbook.sheets error
    By Tpleme in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-05-2018, 09:47 AM
  3. [SOLVED] Selectiong MULTIPLE Sheets in 'ThisWorkbook' using "With Sheets" Command
    By Ourkid123uk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-14-2018, 09:44 AM
  4. Macro failing when Sheet1 was previously created and new sheets are Sheets2+
    By taylorsm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-07-2017, 08:42 AM
  5. Code to Loop through Each Worksheet in ThisWorkbook.Worksheets
    By xcelnovice101 in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 05-08-2014, 04:15 PM
  6. [SOLVED] ThisWorkbook code not hiding named sheets
    By neelie777 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-03-2014, 06:11 PM
  7. [SOLVED] Uncheck Checkbox on ThisWorkbook > On All Sheets
    By cychua in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-23-2013, 11:49 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