I have a summary sheet which gets information feed to the cells from other sheets.
The attached example file does include the other sheets.
As this file has several users, which have beginner excel skills. Their only job is to fill in the "Paid date".
The created rows will come to an end at some point, so I wanted to create a button, which will ask the user
how many rows they would like to add. To make the file easy to use.
This far I came and now I get a warning: Run-time error '1004', Method 'Range' of object_Global' failed.
And the code does not copy formulas from row 4.
VBA code so far:
'adding rows to a sheet Sub Add_rows() Dim iRow As Long Dim iCount As Long Dim i As Long Dim SourceCell As Range Dim FillRange As Range iCount = InputBox(Prompt:="How many rows?") 'should I ask where to insert the new rows or can 'it be inserted automatically before the grey row 34? iRow = InputBox _ (Prompt:="Row nbr where the latest reference is? :") For i = 1 To iCount Rows(iRow).EntireRow.Insert Next i 'Add formula to new rows - which does not work! Set SourceCell = ActiveSheet.Cells(iRow - 1, Range("A4;H4")) Set FillRange = ActiveSheet.Range("A4;H4") SourceCell.AutoFill Destination:=FillRange End Sub
1) Is it possible to skip asking "where to insert the new rows" -> insert the new rows straight after latest cell on column A, where is a value.
2) Copy the formulas from the first row number 4, to the new rows?
I'm really a beginner with VBA, so any help would be just wonderful!
ps. the file attached.