Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Looping" Script 1

Status
Not open for further replies.

NumberCrunchingMonky

Technical User
Feb 5, 2004
30
US
In a nutshell, I have a list of projects to which I linked a graph that plots data dynamically, based on the active row of the list. I scroll up or down to a particular project title, press the button the macro is assigned to, and the graph is updated with the parameters that correspond to the project title in the active cell.

I'd like to nix the button so that the graph updates automatically when I move the active cell up and down the list. I don't know if this would be "event" driven (ie. prompted by the movement of the active cell), or better accomplished by looping the script.

Here's the code:

Sub UpdateChart()
If ActiveCell.Row > 2 And ActiveCell.Row < 20 Then _
ActiveSheet.Calculate
End Sub

I appreciate your help,

NCM
 
The sheets have an event that will suit you just fine...

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
call UpdateChart
end sub

in the sheet's code window (not a module)
you might need to change your UpdateChart to a Public sub (I can't remember if the default is public or private)


SteveO


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top