Solved

Chart Enhancement with Macro Change

Posted on 2011-09-22
5
329 Views
Last Modified: 2012-05-12
EE Professionals,

I have a Chart that EE helped me create that needs an enhancement.  Presently if you add a Task and assign it a number in the Critical Path, it will adjust the data but not the chart.  It's also difficult to add tasks because the data is in line with the chart for part of it.  

Can the "Update" macro be made automatic?  So that when there is a change to the data and the "Enter" key is pressed, the table is automatically updated?

B.
RASCI-Sheetv3.xlsm
0
Comment
Question by:Bright01
  • 3
  • 2
5 Comments
 
LVL 50

Expert Comment

by:teylyn
ID: 36579793
Hello Bright,

You can combine the Worksheet_Change event and the macro that updates the RACI table.

Right-click on the sheet tab, click View Code to open the VB Editor
Double-click "Sheet1 (RASCI)" in the Navigation pane of the VBE
Scroll down to the end of the Worksheet_Change procedure and before the "End Sub" line enter

    PopulateRasciTable

The last four lines of the code should now read

        End If
    End With
    PopulateRasciTable
End Sub

Open in new window


Now, whenever you add a row of data to the text table, as soon as you enter a number in column A, the row will be sorted into the data table, and an entry for that row value will be created in the RASCI chart. Whenever you edit the number, description or RASCI letter for a row, it will be reflected in the RASCI table.

cheers, teylyn
0
 

Author Comment

by:Bright01
ID: 36579986
Teylyn,

Thank you for  the quick response.  It works great!  Is there a way where the cursor won't revert back to the top?   Thank you,

B.
0
 
LVL 50

Accepted Solution

by:
teylyn earned 500 total points
ID: 36580083
In the Worksheet_Change event of the RASCI sheet, add this line before End Sub


    Target.Select

The last few lines of the code should read:

            With Application
                .EnableEvents = True
                .ScreenUpdating = True
            End With
        End If
    End With
    PopulateRasciTable
    Target.Select
End Sub

Open in new window


The cursor will stay on the same row as it was in when the new data was entered.

Due to the macro that sorts the table by the number in column A upon each change, I don't see an easy way to move the active cell to the row where the data lives after the table has been sorted.

To reduce the screen flickering, you could add

Application.ScreenUpdating = False

at the start of the procedure ...

Private Sub Worksheet_Change(ByVal Target As Range)
    
Application.ScreenUpdating = False

    Dim LastR As Long

Open in new window


... and

    Application.ScreenUpdating = True

before the sub ends

            With Application
                .EnableEvents = True
                .ScreenUpdating = True
            End With
        End If
    End With
    PopulateRasciTable
    Target.Select
    Application.ScreenUpdating = True
End Sub

Open in new window


0
 

Author Closing Comment

by:Bright01
ID: 36580174
Teylyn!  Great job.  Thank you very much.  I will most likely be asking a related question on this as this function continues to be built out. And I thought you said you were a formulas person!

Cheers,

B.
0
 
LVL 50

Expert Comment

by:teylyn
ID: 36580246
Yeah, well, stretching and all :-)

Thanks for the grade.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now