Hello: The following codes finds the last row in a table and then creates a simple numerical index starting with 1. A couple of things:
==> Is there a way to refer to column C without hard coding it so I can add and remove columns without a problem?
==> Is there a way to refer to cell C7 without hard coding it so I can add and remove rows without a problem?
I've used the named range "data_index" in another range, but can't seem to get it to solve the above.
Thank you!
============================
Sub index_fill()
Call reset
Range("C" & Rows.Count).End(xlUp).Select
Range(Selection, "C7").Select
Selection.ClearContents
Range("data_index").Offset(1, 0).Value = 1
Selection.DataSeries Rowcol:=xlColumns, Type:=xlLinear, Date:=xlDay, _
Step:=1, Trend:=False
Range("data_date").Select
End Sub
==> Is there a way to refer to column C without hard coding it so I can add and remove columns without a problem?
==> Is there a way to refer to cell C7 without hard coding it so I can add and remove rows without a problem?
I've used the named range "data_index" in another range, but can't seem to get it to solve the above.
Thank you!
============================
Sub index_fill()
Call reset
Range("C" & Rows.Count).End(xlUp).Select
Range(Selection, "C7").Select
Selection.ClearContents
Range("data_index").Offset(1, 0).Value = 1
Selection.DataSeries Rowcol:=xlColumns, Type:=xlLinear, Date:=xlDay, _
Step:=1, Trend:=False
Range("data_date").Select
End Sub