Hi, I've two sheets with values, each sheet have only one column but with a lot of rows. I need to get only the values from the second sheet that aren't on the first one and write them into a new sheet. For that I build this code:
When values reach 1048576 then I got a error so I need to move to a new sheet dinamically or to a new column inside the same sheet. Can any help me on this?
PHP:
Sub Button1_Click()
Dim i As Long
Dim j As Long
Dim k As Long
Dim number1 As Double
Dim number2 As Double
Dim numbers() As Double
Dim rows1 As Long
Dim rows2 As Long
Dim rows3 As Long
rows1 = Worksheets("bl_db").UsedRange.Rows.Count
rows2 = Worksheets("cm_db").UsedRange.Rows.Count
rows3 = Worksheets("new_db").UsedRange.Rows.Count
Worksheets("dbmanuel-clanmovil-blacklist").Cells(1, "A").Value = "Números en Base - Lista Negra"
Worksheets("dbmanuel-clanmovil-blacklist").Cells(2, "A").Value = "Números en Base - Clan Movil"
Worksheets("dbmanuel-clanmovil-blacklist").Cells(3, "A").Value = "Números en Base - BD Nueva (Manuel)"
Worksheets("dbmanuel-clanmovil-blacklist").Cells(1, "B").Value = rows1
Worksheets("dbmanuel-clanmovil-blacklist").Cells(2, "B").Value = rows2
Worksheets("dbmanuel-clanmovil-blacklist").Cells(3, "B").Value = rows3
k = 5
'strText = InputBox("Enter a song name:")
For i = 1 To rows1
number1 = Worksheets("bl_db").Cells(i, "A").Value
For j = 1 To rows2
number2 = Worksheets("cm_db").Cells(j, "A").Value
If (number1 <> number2) Then
If (Left(number2, 1) = "0") Then
number2 = Right(number2, 10)
ElseIf (Left(number2, 2) = "58") Then
number2 = Right(number2, 10)
End If
If (k <> 1048576) Then
Worksheets("dbmanuel-clanmovil-blacklist").Cells(k, "A").Value = number2
Else
Worksheets("dbmanuel-clanmovil-blacklist").Cells(k, "B").Value = number2
End If
k = k + 1
End If
Next j
Next i
End Sub
When values reach 1048576 then I got a error so I need to move to a new sheet dinamically or to a new column inside the same sheet. Can any help me on this?