Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
monkeygirl
 
Posts: n/a
Default help macro for formatting pie chart


Hi

I've got a macro for formatting pie charts in a report that I produce.
The idea is that any count under 3 is not shown in the pie chart. The
macro seems to work for most tables, but doesn't work when there are
blank cells at the end of a table or the final column has a blank cell
- it puts 0% labels on the pie chart.

Can anyone help please (my vba skills are very rusty....) - I've
copied the code below....

Thanks! :)



Sub CalloutsChartData1()

' declare variables
Dim intCount As Integer
Dim intlength As Integer
Dim ChartValue As String
Dim strStart As String
Dim strEnd As String
' initialise count
intCount = 1
' initialise variable within if statement
Do Until intCount = 3
If intCount = 1 Then
ChartValue = strDataType + "Title"
ElseIf intCount = 2 Then
ChartValue = strDataType
End If

' select the sheet
Worksheets(strSheetName).Select
' select the range
Range(ChartValue).Select
' name the first cell in range
ActiveWorkbook.Names.Add Name:=(strDataType + "Start"),
RefersToR1C1:=ActiveCell
' move right to last cell with data
Selection.End(xlToRight).Select
' name the last cell
ActiveWorkbook.Names.Add Name:=(strDataType + "End"),
RefersToR1C1:=ActiveCell
strStart = strDataType + "Start"
strEnd = strDataType + "End"
' select the range between first cell selected and last cell selected
Range(strStart + ":" + strEnd).Select
' name the selected range
ActiveWorkbook.Names.Add Name:=(ChartValue + "Data"),
RefersToR1C1:=Selection
intCount = intCount + 1

Loop
' clear highlighted ranges
Range("endprogramrange").Clear

End Sub


--
monkeygirl
------------------------------------------------------------------------
monkeygirl's Profile: http://www.excelforum.com/member.php...fo&userid=2451
View this thread: http://www.excelforum.com/showthread...hreadid=518166

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
Data Range Mess Karen Charts and Charting in Excel 18 January 14th 06 02:34 PM
chart MAcro to change on activecell flow23 Excel Discussion (Misc queries) 0 December 7th 05 04:46 PM
Activating a Chart object Hari Prasadh Charts and Charting in Excel 6 August 2nd 05 07:22 PM
Urgent Chart Questions Brent E Excel Discussion (Misc queries) 0 May 9th 05 11:01 PM
Urgent Chart Assistance Requested Brent E Excel Discussion (Misc queries) 0 May 9th 05 11:01 PM


All times are GMT +1. The time now is 06:04 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"