+ Reply to Thread
Results 1 to 6 of 6

Need to modify code to loop through these sheets and clear contents

  1. #1
    Forum Contributor
    Join Date
    06-02-2014
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    235

    Need to modify code to loop through these sheets and clear contents

    I am trying to modify this code to loop though these specific sheets and clear contents of the selection. I don't thick I can use the recorder to do this? The 2nd piece to this is i would like it to unlock ALL sheets in the workbook (not just those selected) then lock at the end.

    Here is the code, any help is GREATLY APPRECIATED!

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Need to modify code to loop through these sheets and clear contents

    Try this:

    Please Login or Register  to view this content.
    Last edited by Olly; 10-30-2019 at 05:43 AM.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

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

    Re: Need to modify code to loop through these sheets and clear contents

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

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Need to modify code to loop through these sheets and clear contents

    @ Olly

    Probably typo but last part of code should be

    Please Login or Register  to view this content.
    to protect sheets again
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  5. #5
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Need to modify code to loop through these sheets and clear contents

    Well spotted! Typo indeed. Corrected

  6. #6
    Forum Contributor
    Join Date
    06-02-2014
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    235

    Re: Need to modify code to loop through these sheets and clear contents

    That worked! Thanks guys!

+ 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. [SOLVED] loop through each nth row and clear contents
    By ANDREAAS in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-06-2019, 12:59 PM
  2. [SOLVED] Loop through Column, clear contents of the row, where criteria is met
    By ABSTRAKTUS in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-26-2018, 03:29 AM
  3. [SOLVED] amend code to clear contents and format in vba except row 1 in specific sheets
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-06-2018, 10:36 AM
  4. I need to code to clear contents the several fixed ranges of several sheets
    By samahhamaad in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-03-2016, 05:21 PM
  5. Modify Macro : Clear contents <> Delete
    By guatelize in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-25-2013, 06:09 AM
  6. Code to clear contents of specific cells based upon if key exists in other sheets
    By seputus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-31-2013, 07:25 PM
  7. [SOLVED] Modify Auto Clear - VB Code
    By SVTF in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-01-2012, 02:31 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