bulletshiva
New Member
- Joined
- Jun 6, 2018
- Messages
- 11
Hello,
I have a code which will check the range for letter "E" and will copy all rows to sheet purchasing.
Now i have a need that the macro should check another condition before the rows are copied to sheet 'purchasing'
It should check for "E" or "F" in column 'type'. If of "F" my below macro should work with this condition.
can somebody modify the code to do the job
Private Sub Purchase()
Dim c As Range
Dim j As Integer
Dim Source As Worksheet
Dim Target As Worksheet
' Change worksheet designations as needed
Set Source = ActiveWorkbook.Worksheets("Process_Data")
Set Target = ActiveWorkbook.Worksheets("Purchasing")
j = 1 ' Start copying to row 1 in target sheet
For Each c In Source.Range("E2:S500") ' Do 1000 rows
If c = "E" Then
'Source.Rows(c.Row).Copy Target.Rows(j)
Source.Range(Cells(c.Row, 1), Cells(c.Row, 3)).Copy Target.rows(j)
j = j + 1
End If
Next c
End Sub
I have a code which will check the range for letter "E" and will copy all rows to sheet purchasing.
Now i have a need that the macro should check another condition before the rows are copied to sheet 'purchasing'
It should check for "E" or "F" in column 'type'. If of "F" my below macro should work with this condition.
can somebody modify the code to do the job
Private Sub Purchase()
Dim c As Range
Dim j As Integer
Dim Source As Worksheet
Dim Target As Worksheet
' Change worksheet designations as needed
Set Source = ActiveWorkbook.Worksheets("Process_Data")
Set Target = ActiveWorkbook.Worksheets("Purchasing")
j = 1 ' Start copying to row 1 in target sheet
For Each c In Source.Range("E2:S500") ' Do 1000 rows
If c = "E" Then
'Source.Rows(c.Row).Copy Target.Rows(j)
Source.Range(Cells(c.Row, 1), Cells(c.Row, 3)).Copy Target.rows(j)
j = j + 1
End If
Next c
End Sub