Get the Excel file here
chrisjterrell....
Grab the Free VBA Quick Reference Guide
www.chrisjterr...
Are you annoyed with Charts that won't fit within the cells? This little bit of code can be a lifesaver. I highly recommend you add this code to your Personal workbook.
In this video, we provide code that will allow you to select a chart and then select a range from an Application InputBox and the code will resize the chart to exactly match the selected cell range.
The Code:
Sub SnapChart()
On Error Resume Next
Dim chrt As Chart
Dim rng As Range
Set chrt = ActiveChart
'An Application inputbox can return ranges
Set rng = Application.InputBox("Select Range", "Selection", Type:=8)
chrt.Parent.Top = rng.Top
chrt.Parent.Left = rng.Left
chrt.Parent.Height = rng.Height
chrt.Parent.Width = rng.Width
End Sub
Негізгі бет Excel VBA Snap Chart to Range - Resize a Chart to Match the Exactly Match Cells
Пікірлер: 2