Results 1 to 9 of 9

Excel 2013 Macro only running on 1 Sheet within multi sheet Excel Workbook

Threaded View

  1. #1
    Registered User
    Join Date
    07-19-2017
    Location
    Auckland
    MS-Off Ver
    Microsoft Office 2013
    Posts
    15

    Excel 2013 Macro only running on 1 Sheet within multi sheet Excel Workbook

    Hi There,

    I would really appreciate some asssistance with this. This Macro is only running successfully on 1 Excel Sheet within an Excel work book that has around 10 sheets. I am wanting it to only run on the active sheet that I am working in at the time. I do not want it to run on all sheets at the same time.

    Have I dont something wrong with the code or is there something further I can add to specifiy this.


    Private Sub Workbook_Open()
    Activesheet.Unprotect Password:="Yourpasswordhere"
    Dim colorIndex As Integer
    colorIndex = 3
    Dim xRg As Range
    Application.ScreenUpdating = False
    For Each xRg In ActiveSheet.UsedRange.Cells
    Dim color As Long
    color = xRg.Interior.colorIndex
    If (color = colorIndex) Then
    xRg.Locked = True
    End If
    Next xRg
    Application.ScreenUpdating = True
    Activesheet.Protect Password:="Yourpasswordhere"
    End Sub
    Last edited by aLi3nZ; 07-19-2017 at 12:54 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 05-13-2016, 01:01 PM
  2. [SOLVED] When running a Macro, it crashes my Excel 2013... Why?
    By fleyd in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-24-2015, 11:50 AM
  3. [SOLVED] Excel 2013 - Macro to import sheet from another wb not working.
    By beenbee in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-07-2015, 05:04 AM
  4. Copy rows from one sheet to another sheet excel 2013
    By billisnice in forum Excel General
    Replies: 2
    Last Post: 04-30-2015, 09:41 PM
  5. How To Open an Macro From 2003 Excel in 2013 Excel Spread Sheet?
    By ADubin in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-24-2015, 09:22 PM
  6. Excel 2013 - Macro to update new sheet
    By quabba in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-23-2014, 11:53 AM
  7. Automatically transfer data from one sheet to another in a workbook - Excel 2013
    By WGBarry in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-19-2013, 01:03 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