Look in Row if find then

cfer

Well-known Member
Joined
Jul 29, 2002
Messages
560
Hi All,

I would like to be able to in Sheet 1, look in each row, starting row 3, rows are dynamic, columns also may vary.

I am looking for a number 1, only a 1, as there could be more than one number 1, ie 111, in the cell.

If there is a number 1 in any cells of row 3, then copy the value in Column "C" in that row, to Sheet 2 "C5"

Go through each row in Sheet 1 till the last row, each time copy the value to the next row , Column C in Sheet 2.

Any help appreciated.

Cfer
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Try this:
Code:
Sub a926078()
Dim r As Range
Dim x As Long, i As Long, rr As Long, rc As Long

rr = Range("A" & Rows.count).End(xlUp).row
rc = Cells(1, Columns.count).End(xlToLeft).Column
i = 5
For Each r In Range(Cells(3, 1), Cells(rr, rc))
    If r.Value = 1 And r.row <> x Then
    sheets("sheet2").Cells(i, "C").Value = Cells(r.row, "C").Value
    x = r.row
    i = i + 1
    End If
Next r

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,825
Messages
6,121,787
Members
449,049
Latest member
greyangel23

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