spiritbarbie
New Member
- Joined
- May 14, 2018
- Messages
- 3
Hi,
I have a spreadsheet which has a number of formulas. The spreadsheet lists names and payments and I often have to add a high number of new rows but as the sheet is alphabetical not in one place. I have a macro which inserts and new row and copies down the formulas I need but leaves the name section blank.
I have a spreadsheet which has a number of formulas. The spreadsheet lists names and payments and I often have to add a high number of new rows but as the sheet is alphabetical not in one place. I have a macro which inserts and new row and copies down the formulas I need but leaves the name section blank.
Code:
Sub AddNewEmployee()
Dim rw As Long, clAs Long
Selection.EntireRow.Insert
n = ActiveCell.Row
For cl = 1 ToColumns.Count
If Cells(n -1, cl).HasFormula Then
Cells(n -1, cl).Copy Cells(n, cl)
End If
Next
Cells(n, 1).Select
End Sub
[code]
I have two problems though. There is a section of the sheet Columns AB and AC and AG to AR which have formulas specific to that employee hat I do not want to copy over, is there a way to amend what I have so these sections are avoided? The second problem is that this does not work is I need to input someone above the existing first entry, how can I alter it so it work in every row?
Thanks [IMG]file:///C:/Users/GABRIE~1/AppData/Local/Temp/msohtmlclip1/01/clip_image001.gif[/IMG]