ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Finding data (https://www.excelbanter.com/excel-programming/326012-finding-data.html)

Paulc

Finding data
 
Using XL 2000

My worksheet contains 20 columns, A:T. The cells in each column (from row 2
down) contain either a "True" or "False" phrase.

I need a routine to loop through the 20 columns a row at a time.
Row 1 contains random text phrases.

Example;
Starting in Row 2, where the cell content in the first column (A) equals
"True", add the cell content in row 1 (A1) to a variable called CellString.
Continue, adding the content in B1, C1, D1 etc to CellString where the above
condition is met until the loop completes for that row.

When the loop for each row finishes I will transfer the content of
CellString to another cell in a different worksheet.

The loop repeats for as long as there is data in each row.

Any ideas appreciated.

Thanks, Paul

Bob Phillips[_6_]

Finding data
 

For j = 1 To Cells(1,Columns.Count).End(xlToLeft).Column
CellString = ""
Fo i = 2 To Cells(Rows.Count,j).End(xlUp).Row
If Cells(i,j).Value Then
CellString = CellString & Cells(1,j).Value
End If
Next i
'your code
Next j

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Paulc" wrote in message
...
Using XL 2000

My worksheet contains 20 columns, A:T. The cells in each column (from row

2
down) contain either a "True" or "False" phrase.

I need a routine to loop through the 20 columns a row at a time.
Row 1 contains random text phrases.

Example;
Starting in Row 2, where the cell content in the first column (A) equals
"True", add the cell content in row 1 (A1) to a variable called

CellString.
Continue, adding the content in B1, C1, D1 etc to CellString where the

above
condition is met until the loop completes for that row.

When the loop for each row finishes I will transfer the content of
CellString to another cell in a different worksheet.

The loop repeats for as long as there is data in each row.

Any ideas appreciated.

Thanks, Paul





All times are GMT +1. The time now is 10:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com