+ Reply to Thread
Results 1 to 6 of 6

Working Macro not auto updating

Hybrid View

  1. #1
    Registered User
    Join Date
    12-01-2011
    Location
    Tampa, Florida
    MS-Off Ver
    Excel 2013
    Posts
    7

    Working Macro not auto updating

    Hello All, and thanks for any feedback. This is in Excel 2013

    I have the following Macro in my workbook which does exactly what it is suppose to do when I run the macro,
    but it does not run on it's own like it suppose to do??? What did I do wrong here?

    Sub Worksheet_Change()
    Application.ScreenUpdating = False
        ActiveWorkbook.Worksheets("Clients").Sort.SortFields.Clear
        ActiveWorkbook.Worksheets("Clients").Sort.SortFields.Add Key:=Range("L2:L100" _
            ), SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:="YES,NO", _
            DataOption:=xlSortNormal
        ActiveWorkbook.Worksheets("Clients").Sort.SortFields.Add Key:=Range("C2:C100" _
            ), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
        With ActiveWorkbook.Worksheets("Clients").Sort
            .SetRange Range("A1:L100")
            .Header = xlYes
            .MatchCase = False
            .Orientation = xlTopToBottom
            .SortMethod = xlPinYin
            .Apply
        End With
        Application.ScreenUpdating = True
    End Sub
    Thanks for any input
    Last edited by cccote; 03-17-2014 at 07:57 PM.

  2. #2
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Working Macro not auto updating

    Declaration is not correct - it must be:
    Private Sub Worksheet_Change(ByVal Target As Range)
    Also code must be in module for correct worksheet.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,651

    Re: Working Macro not auto updating

    Also:

    Did you put the code in the Clients worksheet's code module and not in a standard code module like Module1?

    Do you want it to run on any change to the worksheet?
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Registered User
    Join Date
    12-01-2011
    Location
    Tampa, Florida
    MS-Off Ver
    Excel 2013
    Posts
    7

    Re: Working Macro not auto updating

    Hi, thanks for the help, I did change it to "Private Sub" (still not working) and it shows in both the worksheet code and
    under Module1. See Pictures, and yes I want it to run after any update withing that worksheet. What am I missing?
    Module1.JPGSheetModule.jpg

  5. #5
    Registered User
    Join Date
    12-01-2011
    Location
    Tampa, Florida
    MS-Off Ver
    Excel 2013
    Posts
    7

    Re: Working Macro not auto updating

    Guys I got it, I thought it was in the worksheet because it showed when selected, but when I double clicked
    the worksheet it was empty, so entered it there and Voila it's running.
    Thank you both very much for your input, it is appreciated.

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,651

    Re: Working Macro not auto updating

    As Izandol pointed out, it has to be called exactly this...

    Private Sub Worksheet_Change(ByVal Target As Range)
    And it's only located in the worksheet code module. Not in Module1.

    EDIT: disregard

+ 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. Working with Dates, VB MAcro to Auto Filter on last 7 days
    By Rikkdh in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 06-20-2013, 10:01 AM
  2. Updating pivot table filters through a macro has stopped working, help please
    By JasperTata in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-21-2012, 09:53 AM
  3. Help with automatic chart updating/auto updating today function
    By Tux2424 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 09-26-2012, 04:45 PM
  4. Auto list updating not updating
    By khank in forum Excel General
    Replies: 8
    Last Post: 05-28-2011, 11:03 PM
  5. Auto Macro for updating Current Month
    By dandavis1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-01-2010, 05:37 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