Help with look up and row paste

jedibrown

Board Regular
Joined
Oct 17, 2011
Messages
136
Hi,

Basically, I am creating some data and I am a bit stuck.

I would like to say:

If any cells in column c have the word "Giant" in it (there will be a sentance in each cell but I would like it to pick out the specific word) - Then please paste the whole line into sheet 2.

Is this possible?

Many thanks
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
I have fixed it! It was because I was using capital letters for P&L apparently! I change them to lower cases and it's now picking them up.

Thanks again for all of your help - It has made my life a lot easier!
 
Upvote 0
Sorry - I have thought of another problem.

Is there any way that I can ask it to look at column G and if it says "complete" to not paste that line?
 
Upvote 0
Try like this

Code:
Private Sub CommandButton1_Click()
Dim LR As Long, i As Long
LR = Range("B" & Rows.Count).End(xlUp).Row
For i = 1 To LR
    If Not IsError(Range("B" & i)) Then
        If LCase(Range("G" & i).Value) <> "complete" And (InStr(LCase(Range("B" & i).Value), "giant") > 0 Or InStr(LCase(Range("B" & i).Value), "large") > 0) Then Rows(i).Copy Destination:=Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1)
    End If
Next i
End Sub
 
Upvote 0
Hi - me again!

Would I also be able to get it to write over what was there before instead of adding it on?

Thank you.
 
Upvote 0
Try

Code:
Private Sub CommandButton1_Click()
Dim LR As Long, i As Long
Sheets("Sheet2").UsedRange.ClearContents
LR = Range("B" & Rows.Count).End(xlUp).Row
For i = 1 To LR
    If Not IsError(Range("B" & i)) Then
        If LCase(Range("G" & i).Value) <> "complete" And (InStr(LCase(Range("B" & i).Value), "giant") > 0 Or InStr(LCase(Range("B" & i).Value), "large") > 0) Then Rows(i).Copy Destination:=Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1)
    End If
Next i
End Sub
 
Upvote 0
Hi - Sorry I'm back!

So the part which says, don't paste if row G is complete. Can you also let me know how to add -don't paste row g is complete or rejected?

Thank you!
 
Upvote 0
Try

Code:
Private Sub CommandButton1_Click()
Dim LR As Long, i As Long
Sheets("Sheet2").UsedRange.ClearContents
LR = Range("B" & Rows.Count).End(xlUp).Row
For i = 1 To LR
    If Not IsError(Range("B" & i)) Then
        If LCase(Range("G" & i).Value) <> "complete" And _
        LCase(Range("G" & i).Value) <> "rejected" And _
        (InStr(LCase(Range("B" & i).Value), "giant") > 0 Or InStr(LCase(Range("B" & i).Value), "large") > 0) _
        Then Rows(i).Copy Destination:=Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1)
    End If
Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top