graph from every nth cell

Arie Bos

Board Regular
Joined
Mar 25, 2016
Messages
224
Office Version
  1. 365
Platform
  1. Windows
I would like create a graph from every 4th cell in a column, e.g. B4, B8, B12, B16 etcis there a way to do this?Thank you, Excelleers
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
If you set the chart series to the named range ("=Sheet1!Data"), then along with the code below, every fourth value you add to one column will be added to below the last value in a helper column and the named range will be extended to include the added value.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    With Target
        If .Column = 2 And .Row Mod 4 = 0 Then
            Cells(.Parent.Cells(.Parent.Rows.Count, "C").End(xlUp).Row + 1, "C").Value2 = .Value2
            ThisWorkbook.Worksheets("Sheet1").Names("Data").RefersTo = Range(Cells(2, 3), Cells(.Parent.Cells(.Parent.Rows.Count, "C").End(xlUp).Row, 3))
        End If
    End With
End Sub

Haven't considered adding more than one value at a time, nor deleting cells... But this should be a good start, and will give you something to work from. I'd be surprised if the gurus here don't come up with a better subroutine or a more elegant formula-based solution.

Good luck!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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