dinesababu1
New Member
- Joined
- Oct 28, 2016
- Messages
- 13
Dear Excel Community
I really need your help! I have a ton of bills which I need to submit for payment and I need help to get the data into the format I require.
Basically I have a spreadsheet with list of company codes in Column A. I need a macro that can insert a particular selection when the value in column A changes.
I have no issue copying the selection, but when I try to insert the selection the macro does not work.
The following is what I am trying, but it isn't working, can someone please help?
Sheets("Formula").Select
Rows("7:14").Select
Selection.Copy
Sheets("Final Format").Select
Dim lRow As Long
For lRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row To 9 Step -1
If Cells(lRow, "A") <> Cells(lRow - 1, "A") Then Selection.Insert
Next lRow
I really need your help! I have a ton of bills which I need to submit for payment and I need help to get the data into the format I require.
Basically I have a spreadsheet with list of company codes in Column A. I need a macro that can insert a particular selection when the value in column A changes.
I have no issue copying the selection, but when I try to insert the selection the macro does not work.
The following is what I am trying, but it isn't working, can someone please help?
Sheets("Formula").Select
Rows("7:14").Select
Selection.Copy
Sheets("Final Format").Select
Dim lRow As Long
For lRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row To 9 Step -1
If Cells(lRow, "A") <> Cells(lRow - 1, "A") Then Selection.Insert
Next lRow