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

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Akuini

Well-known Member
Joined
Feb 1, 2016
Messages
3,787
Office Version
  1. 365
Platform
  1. Windows
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
 

cfer

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

Thanks worked, made life a bit easier.

Cfer
 

Akuini

Well-known Member
Joined
Feb 1, 2016
Messages
3,787
Office Version
  1. 365
Platform
  1. Windows
You're welcome.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,863
Messages
5,834,050
Members
430,259
Latest member
msthiagu

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
Top