HowTo add row to series data

E

Eggle

1) insert row with ShiftDown
2) apply new data to the newly emptied cells
3) preserve original chart series range

1) after this code row 2 is empty cells
Excel.Worksheet chart = (Excel.Worksheet)book.Worksheets["Chart Data"];
Excel.Range rngToday = chart.get_Range("A2", "D2");
rngToday.Insert(Excel.XlInsertShiftDirection.xlShiftDown);

2) this puts todays date into A2
rngToday.NumberFormat = "MM/dd";
rngToday.Value = DateTime.Today;

3) OOPS - the chart data is now A3..A7 because of the insert above

How do I reset the souce data to A2..A6
or
Perhaps I can preserve the original setting when I do the insert
---- insert but don't update cell references

???? What's the best way here
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top