ZappAstrim
New Member
- Joined
- Jun 15, 2011
- Messages
- 7
Hello all - I've been chasing through the internet for the last hour and cannot figure this one out. Perhaps you guys can give me a hand.
I have a spreadsheet and have found the perfect script for inserting the number of rows I require as well as copying the formulas I need. This really is a beauty:
Now the thing is that I have a column in my sheets which is always contained in column "B" but the row where the data ID begins is variable. I need to have a unique ID for each data point. So in the example here it's C0001, C0002, C0003 etc. When using this VBA script I loose the continuous numbering and might end up with 200 C0010 data points. Can you help me out with making this work (and making it variable too)?
Please find the example workbook here:
http://dl.dropbox.com/u/15735073/test.xlsm
I have a spreadsheet and have found the perfect script for inserting the number of rows I require as well as copying the formulas I need. This really is a beauty:
Code:
Sub InsertRow()
Dim Rng, n As Long, k As Long
Application.ScreenUpdating = False
Rng = InputBox("Enter number of rows required.")
If Rng = "" Then Exit Sub
Range(ActiveCell, ActiveCell.Offset(Val(Rng) - 1, 0)).EntireRow.Insert
'need to know how many formulas to copy down.
'Assumesfrom A over to last entry in row.
k = ActiveCell.Offset(-1, 0).Row
n = Cells(k, 256).End(xlToLeft).Column
Range(Cells(k, 1), Cells(k + Val(Rng), n)).FillDown
End Sub
Now the thing is that I have a column in my sheets which is always contained in column "B" but the row where the data ID begins is variable. I need to have a unique ID for each data point. So in the example here it's C0001, C0002, C0003 etc. When using this VBA script I loose the continuous numbering and might end up with 200 C0010 data points. Can you help me out with making this work (and making it variable too)?
Please find the example workbook here:
http://dl.dropbox.com/u/15735073/test.xlsm