Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub CommandButton1_Click()
- Dim tempValueA As String
- Dim tempValueB As String
- Dim uFila As Integer
- On Error GoTo Err
- Application.Goto Hoja1.Range("B3"), True
- uFila = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row
- i = 4
- Do While i < uFila
- If Sheets("hoja1").Cells(i, 2) <> Empty Then
- tempValueA = Sheets("hoja1").Cells(i - 1, 2).Value
- tempValueB = Sheets("hoja1").Cells(i, 2).Value
- If tempValueA <> tempValueB Then
- Application.Goto Hoja1.Range("B" & i), True
- Selection.EntireRow.Insert
- uFila = uFila + 1
- i = i + 1
- End If
- i = i + 1
- End If
- Loop
- Application.Goto Hoja1.Range("A1"), True
- Exit Sub
- Err:
- MsgBox ("Error :" & Err.Number & " - " & Err.Description)
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement