Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Update on Current Selection

The following code works to chart whatever is in
the active cell. What I need is to chart the active
selection. Is there an easy to adjust this to do so?
-Randy-

PS: With the CheckBox1 option gone.

Sub UpdateChart()
Dim TheChartObj As ChartObject
Dim TheChart As Chart
Dim UserRow As Long
Dim CatTitles As Range
Dim SrcRange As Range
Dim SourceData As Range

If Sheets("Sheet1").CheckBox1 Then
Set TheChartObj = ActiveSheet.ChartObjects(1)
Set TheChart = TheChartObj.Chart
UserRow = ActiveCell.Row
If UserRow < 3 Or IsEmpty(Cells(UserRow, 1)) Then
TheChartObj.Visible = False
Else
Set CatTitles = Range("A2:F2")
Set SrcRange = Range(Cells(UserRow, 1), Cells(UserRow, 6))
Set SourceData = Union(CatTitles, SrcRange)
TheChart.SetSourceData _
Source:=SourceData, PlotBy:=xlRows
TheChartObj.Visible = True
End If
End If
End Sub


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
Update Current Row enyaw Excel Discussion (Misc queries) 3 April 21st 07 01:34 PM
update Totals using current date BrianMcC Excel Discussion (Misc queries) 1 March 10th 07 12:16 PM
Update current time automatically? JENNYC Excel Discussion (Misc queries) 3 July 29th 05 12:05 AM
excel change default column sort to current selection john palmer Excel Worksheet Functions 2 March 8th 05 03:07 PM
Calculated value based on current line selection Bruce Roberson Excel Programming 0 August 20th 03 07:51 PM


All times are GMT +1. The time now is 11:01 AM.

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

About Us

"It's about Microsoft Excel"