Hi guys
I hope someone can help me with this one!
I need to check the value of the Cell in B column, once it is changed I need to insert a new row, copy the contains of the first row to the new row, my code is not working properly
this is the sheet:
https://app.box.com/s/bntxmsw7wzbtonxrab57
I hope someone can help me with this one!
I need to check the value of the Cell in B column, once it is changed I need to insert a new row, copy the contains of the first row to the new row, my code is not working properly
this is the sheet:
https://app.box.com/s/bntxmsw7wzbtonxrab57
Code:
Sub Insertrow() SheetName = "Sheet1"
RngStr = "B2:B" + CStr(Worksheets(SheetName).UsedRange.Rows.Count)
Set Rng = Worksheets(SheetName).Range(RngStr)
For Each Cell In Rng
If Application.CountIf(Rng, Cell.Value) = 1 Then
Cell.EntireRow.Insert
Rows("1:1").Select
Selection.Copy
Range(Rng).Select
ActiveSheet.Paste
End If
Next Cell
End Sub