hELLO all of you.
I have a vey large spreadhseet OP3 with 20000-25000 rows in it and would like to copy paste rows in another woksheet of the same spreadsheet. The conditions are in column z and they are are:"SJJG:SERVICE - JJL, GARN" and "C02:Garnishment Filing Fee". I need to copy -paste rows if they meets thses conditons in column z .The below code that i have worked out , the problem that is only copy -paste only rows with :"SJJG:SERVICE - JJL, GARN" not second conditon.
Dim LDate As String
LFound = False
Dim c As Range
Dim c2 As Range
Dim Filename As String
Dim NewSheet As Worksheet
Filename = InputBox("Enter the file name")
Worksheets.Add().Name = Filename
Dim NewRow As Integer
NewRow = Worksheets(Filename).Range("Z1").Value + 1
Sheets("OP3").Activate
Dim strsearch As String, strsearch1 As String, lastline As Integer, tocopy As Integer
strsearch = "C02:Garnishment Filing Fee"
lastline = Range("Z65536").End(xlUp).Row
'NewRow = 1
' Copy cost for GARNISHEMNT to OP3GARN spreadsheet the same worksheet
For i = 1 To lastline
For Each c In Range("Z" & i & ":Z" & i)
If c.Text = strsearch Then
tocopy = 1
End If
Next c
If tocopy = 1 Then
Sheets(Filename).Range(NewRow & ":" & NewRow) = Range(i & ":" & i).Value
NewRow = NewRow + 1
End If
tocopy = 0
Next i
strsearch1 = "SJJG:SERVICE - JJL, GARN"
For i = 1 To lastline
For Each c In Range("Z" & i & ":Z" & i)
If c.Text = strsearch1 Then
tocopy = 1
End If
Next c
If tocopy = 1 Then
Sheets(Filename).Range(NewRow & ":" & NewRow) = Range(i & ":" & i).Value
NewRow = NewRow + 1
End If
tocopy = 0
Next i
Thank you for adivise .
Thnak you ,
Best Reagards,
BorisGomel
I have a vey large spreadhseet OP3 with 20000-25000 rows in it and would like to copy paste rows in another woksheet of the same spreadsheet. The conditions are in column z and they are are:"SJJG:SERVICE - JJL, GARN" and "C02:Garnishment Filing Fee". I need to copy -paste rows if they meets thses conditons in column z .The below code that i have worked out , the problem that is only copy -paste only rows with :"SJJG:SERVICE - JJL, GARN" not second conditon.
Dim LDate As String
LFound = False
Dim c As Range
Dim c2 As Range
Dim Filename As String
Dim NewSheet As Worksheet
Filename = InputBox("Enter the file name")
Worksheets.Add().Name = Filename
Dim NewRow As Integer
NewRow = Worksheets(Filename).Range("Z1").Value + 1
Sheets("OP3").Activate
Dim strsearch As String, strsearch1 As String, lastline As Integer, tocopy As Integer
strsearch = "C02:Garnishment Filing Fee"
lastline = Range("Z65536").End(xlUp).Row
'NewRow = 1
' Copy cost for GARNISHEMNT to OP3GARN spreadsheet the same worksheet
For i = 1 To lastline
For Each c In Range("Z" & i & ":Z" & i)
If c.Text = strsearch Then
tocopy = 1
End If
Next c
If tocopy = 1 Then
Sheets(Filename).Range(NewRow & ":" & NewRow) = Range(i & ":" & i).Value
NewRow = NewRow + 1
End If
tocopy = 0
Next i
strsearch1 = "SJJG:SERVICE - JJL, GARN"
For i = 1 To lastline
For Each c In Range("Z" & i & ":Z" & i)
If c.Text = strsearch1 Then
tocopy = 1
End If
Next c
If tocopy = 1 Then
Sheets(Filename).Range(NewRow & ":" & NewRow) = Range(i & ":" & i).Value
NewRow = NewRow + 1
End If
tocopy = 0
Next i
Thank you for adivise .
Thnak you ,
Best Reagards,
BorisGomel