Hello!
I have a preadsheet where I regulary insert new rows and add some extra cells to the them. The new rows may already exists. I solved that the new rows get the info from the previous ones throgh function.
Now I want to delete the previous rows, I face 2 problems.
1) I loose the values of extra cells in the last rows as I delete the previous row *
2) I cannot go to and come back from the last row automatically to set the value. **
Please help.
Private Sub deletepreviousrange_Click()
MsgBox ("I delete previous addresses!")
Dim alfa
Dim beta
Dim gamma
Dim omega
Dim atlas
alfa = ActiveCell.value
beta = ActiveCell.Offset(0, -4).value
omega = ActiveCell.Offset(0, 3).value
gamma = ActiveCell.Row
Range("tel_1").Activate
While ActiveCell.value <> ""
If ActiveCell.value = beta Then
MsgBox ("I found a previous one")
ActiveCell.Offset(0, 4).Select
Selection.Copy
ActiveCell.Offset(8, 0).Select **
Selection.PasteSpecial Paste:=xlPasteValues
ActiveCell.Offset(-8, -4).Select **
If ActiveCell.value = beta Then
Range(Cells(ActiveCell.Row, 1), Cells(ActiveCell.Row, 28)).Select
If ActiveCell.Row < gamma Then
Selection.Delete *
gamma = gamma - 1
End If
If ActiveCell.Row = gamma Then
MsgBox ("Only the last one remained")
End If
ActiveCell.Offset(0, 19).Select
End If
End If
ActiveCell.Offset(1, 0).Select
Wend
End Sub