Macro to edit a scatter plot

ranafast

New Member
Joined
Jul 23, 2013
Messages
22
Hi,

I have a list of interest rates and durations and was hoping to be able to add in a third dimension of data which would either increase the size of the plotted points or change their colour depending on the rating. So have the normal scatter plot then save me from editing each point manually.

i.e.

A1B1C1D1
Interest RateDurationRating
3%3.5A+
3%3A
4%5A+
2%2AA+
5%10A

<TBODY>
</TBODY>
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
The best way I have worked on this is to sort the information into groups and plot them as separate sets which can be different colors.

Code:
Dim x As Long, y As Long, z As Long, rng1 As Range
                y = 2
                z = 2
                n = Cells(Rows.Count, "A").End(xlUp).Row 'count of all data present
For x = 2 To n Step 1
                    Set rng1 = Union(Range ("A" &x), Range("B" & x), Range("C" & x))
                            If Cells(x, 3).Value = "A+" Then
                                rng1.Copy Range("G" & y)
                                y = y + 1
                            ElseIf Cells(x, 3).Value = "A" Then
                                rng1.Copy Range("K" & z)
                                z = z + 1
                            End If
                Next x

This code allows you to sort through all of your data and copies the values into groups next to your data (you could also put it on another sheet just change

rng1.Copy Range("K" & z) to rng1.copy sheet(2).range("A" & z)

You just want to make sure you leave enough room for all the information to be pasted into the cells.
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top