Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Try this routine for positioning chart objects. The spacing is determined by the widest/tallest objects. There are 2 variables that can be set to control centering. Sub PosCharts() Dim sngLeft As Single Dim sngTop As Single Dim sngHeight As Single Dim sngMaxWidth As Single Dim sngMaxHeight As Single Dim objCht As ChartObject Dim lngIndex As Long Dim blnHorizontalCenter As Boolean Dim blnVerticalCenter As Boolean For Each objCht In ActiveSheet.ChartObjects If objCht.Width sngMaxWidth Then sngMaxWidth = objCht.Width If objCht.Height sngMaxHeight Then sngMaxHeight = objCht.Height Next blnHorizontalCenter = True blnVerticalCenter = True sngTop = 1 For Each objCht In ActiveSheet.ChartObjects lngIndex = lngIndex + 1 If lngIndex 5 Then ' Number of columns lngIndex = 1 sngTop = sngTop + sngMaxHeight + 1 sngLeft = 1 End If If blnVerticalCenter Then objCht.Top = sngTop + ((sngMaxHeight - objCht.Height) / 2) Else objCht.Top = sngTop End If If blnHorizontalCenter Then objCht.Left = sngLeft + ((sngMaxWidth - objCht.Width) / 2) Else objCht.Left = sngLeft End If sngLeft = sngLeft + sngMaxWidth + 1 Next End Sub Cheers Andy -- -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info "navin" wrote in message oups.com... Hi All, I have 15 charts in a sheet. I want to place these charts in a way that the sheet contains, 3 charts in a row (i.e) total five columns. any ideas how to achieve this. thanks, navin |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
charts toolbar / charts disappeared | Charts and Charting in Excel | |||
link excel charts to web pages and update charts automatically | Charts and Charting in Excel | |||
Charts - How to have multiple charts share a legend. | Charts and Charting in Excel | |||
interactive charts for stacked bar charts | Charts and Charting in Excel | |||
Matching the colors Column Charts and Pie Charts | Charts and Charting in Excel |