+ Reply to Thread
Results 1 to 5 of 5

Only edit selected Sheets in workbook

Hybrid View

  1. #1
    Registered User
    Join Date
    04-10-2019
    Location
    VA
    MS-Off Ver
    Excel 2010
    Posts
    23

    Question Only edit selected Sheets in workbook

    I'm designing a schedule and I need to set it up so that when I update the workbook only those sheets that need to be updated have the code run on them.
    Each sheet in the workbook is a month, so if I'm making changes in August I don't need the last 7 months updated, just the remaining 4.

    Right now my Macro updates all the sheets, unless I go in an remove their names from the array, which I don't want to do.

    I know I could probably do this with a checkbox, but honestly I just can't seem to wrap my head around the userforms or active controls. I know enough to assign a macro to a button, which I've already done to run my code and update my sheets.

    Can someone please help me with this and if possible explain how you did it.

    Thank you.
    Attached Files Attached Files
    Last edited by rose8693; 08-20-2021 at 01:11 PM.

  2. #2
    Forum Contributor
    Join Date
    08-09-2012
    Location
    British Columbia
    MS-Off Ver
    Excel 2010
    Posts
    190

    Re: Only edit selected Sheets in workbook

    Did you not look at my response to your question of how to do this using check boxes?
    https://www.excelforum.com/excel-pro...ml#post5558030

  3. #3
    Registered User
    Join Date
    04-10-2019
    Location
    VA
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Only edit selected Sheets in workbook

    @NoSparks

    Apologizes, I didn't even see that that had been replied to. Thank you for the code, took some figuring out but finally got it working.

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,692

    Re: Only edit selected Sheets in workbook

    Another possibility. See attached
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,692

    Re: Only edit selected Sheets in workbook

    Re: "so if I'm making changes in August I don't need the last 7 months updated, just the remaining 4."

    Run from "Developer" - "Macros" or if you have a macro button on every sheet:
    Sub Another_Way()
    Dim a As Long, sh As Worksheet
    a = ActiveSheet.Index
        For Each sh In ThisWorkbook.Worksheets
            If sh.Index > a Then sh.Range("K12").Value = "Hello there!"    '<---- Change as required
        Next sh
    End Sub
    You can also have all the sheet names somewhere in your "Dates" sheet, select the cell that has the month from where you want to start updating and run adjusted above code.
    Sub Another_Way_2()
    Dim a As Long, sh As Worksheet
    a = Sheets(Selection.Value).Index
        For Each sh In ThisWorkbook.Worksheets
            If sh.Index > a Then sh.Range("K12").Value = "Hello there!"    '<---- Change as required
        Next sh
    End Sub

+ 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. Replies: 7
    Last Post: 06-05-2021, 03:23 AM
  2. Export Workbook into a New Workbook with Selected Sheets
    By vikas_newports in forum Excel General
    Replies: 1
    Last Post: 09-07-2018, 03:25 PM
  3. Edit listbox selected items and save to workbook???
    By madforit in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-23-2012, 08:00 AM
  4. Replies: 3
    Last Post: 06-14-2007, 08:26 AM
  5. Replies: 6
    Last Post: 03-29-2006, 07:50 AM
  6. Replies: 6
    Last Post: 03-29-2006, 07:50 AM
  7. Replies: 6
    Last Post: 03-29-2006, 07:50 AM

Tags for this Thread

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