srinidhi
Active Member
Hi All,
I need macro to copy & paste data from one sheet to another. The macro should copy the data based on the following conditions:
Column B has NEW EMP & Old EMP,
Column C has Month,
Column H has list of clients
if NEW EMP is there in Column B & month is equal to current month, if both these conditions are stratified then it should look for Column H with specific names like ABC or DEG or IJK.
Then it should paste the entire column in sheet 8.
I was able to get just ½ way through: my code is
Sub Copypaste()
Set i = Sheets("Sheet1")
Set e = Sheets("Sheet8")
Dim d
Dim j
Set d = 1
Set j = 2
Do Until IsEmpty(i.Range("B" & j))
If i.Range("B" & j) = "New EMP" And i.Range("C" & j) = "May" Then
d = d + 1
e.Rows(d).Value = i.Rows(j).Value
End If
j = j + 1
Loop
End Sub
How to include the or condition in the above macro like if Column H = ABC or DEG or IJK.
I need macro to copy & paste data from one sheet to another. The macro should copy the data based on the following conditions:
Column B has NEW EMP & Old EMP,
Column C has Month,
Column H has list of clients
if NEW EMP is there in Column B & month is equal to current month, if both these conditions are stratified then it should look for Column H with specific names like ABC or DEG or IJK.
Then it should paste the entire column in sheet 8.
I was able to get just ½ way through: my code is
Sub Copypaste()
Set i = Sheets("Sheet1")
Set e = Sheets("Sheet8")
Dim d
Dim j
Set d = 1
Set j = 2
Do Until IsEmpty(i.Range("B" & j))
If i.Range("B" & j) = "New EMP" And i.Range("C" & j) = "May" Then
d = d + 1
e.Rows(d).Value = i.Rows(j).Value
End If
j = j + 1
Loop
End Sub
How to include the or condition in the above macro like if Column H = ABC or DEG or IJK.