Hello!
I have a working VBA macro which copies rows based on a criteria to a new worksheet and deletes rows based on this same criteria from the older ws.
Right now my code looks like this and what I want is the current date added next to each copied row (in the "P" column)
I figured out how to add the current date in a cell but I can't implement it into my macro.
Sub Teljesített_másol_töröl()
Dim gyujto As Worksheet
Dim cel As Worksheet
Dim statusz As String
Dim utolso As Integer
Dim i As Integer
Dim x As Double
Set gyujto = Munka1
Set cel = Munka2
'statusz = gyujto.Range("R2").Value
x = 0
gyujto.Select
utolso = Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To utolso
If Cells(i, 13) = "T" Then
Range(Cells(i, 1), Cells(i, 15)).Copy
cel.Select
Range("A500").End(xlUp).Offset(1, 0).Select
Selection.Insert Shift:=xlDown
x = x + 1
End If
Next i
gyujto.Select
For i = utolso To 2 Step -1
If Cells(i, 13) = "T" Then
Rows(i & ":" & i).EntireRow.Delete
End If
Next i
cel.Select
MsgBox x & " sor másolva"
End Sub
Thanks in advance!
I have a working VBA macro which copies rows based on a criteria to a new worksheet and deletes rows based on this same criteria from the older ws.
Right now my code looks like this and what I want is the current date added next to each copied row (in the "P" column)
I figured out how to add the current date in a cell but I can't implement it into my macro.
Sub Teljesített_másol_töröl()
Dim gyujto As Worksheet
Dim cel As Worksheet
Dim statusz As String
Dim utolso As Integer
Dim i As Integer
Dim x As Double
Set gyujto = Munka1
Set cel = Munka2
'statusz = gyujto.Range("R2").Value
x = 0
gyujto.Select
utolso = Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To utolso
If Cells(i, 13) = "T" Then
Range(Cells(i, 1), Cells(i, 15)).Copy
cel.Select
Range("A500").End(xlUp).Offset(1, 0).Select
Selection.Insert Shift:=xlDown
x = x + 1
End If
Next i
gyujto.Select
For i = utolso To 2 Step -1
If Cells(i, 13) = "T" Then
Rows(i & ":" & i).EntireRow.Delete
End If
Next i
cel.Select
MsgBox x & " sor másolva"
End Sub
Thanks in advance!