Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default "Looping" Code

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.Calculat
End Su

I appreciate your help

E

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default "Looping" Code

Hi
you may try using the Selection_change worksheet event. Put the
following in your worksheet module (checks for a selection in A2:A20):

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("A2:A20")) Is Nothing Then Exit Sub
On Error GoTo CleanUp:
With Target
Application.EnableEvents = False
'insert your code to change the chart
End If
End With
CleanUp:
Application.EnableEvents = True
End Sub



--
Regards
Frank Kabel
Frankfurt, Germany

exceluser wrote:
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.

EU


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default "Looping" Code

Thanks for your valuable help, Frank
Regards
EU
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
Looking for VB code to test for "RING" , "BUSY" disconnects or other signals BruceJ[_2_] Excel Programming 3 November 20th 03 01:55 AM


All times are GMT +1. The time now is 02:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"