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
 

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Akuini

Well-known Member
Joined
Feb 1, 2016
Messages
2,936
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
2,936
Office Version
  1. 365
Platform
  1. Windows
You're welcome.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,561
Messages
5,596,849
Members
414,107
Latest member
Tigretto

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