Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
column loop problem??
I have a spreadsheet with 3 columns. Column 1 will have various text and
will each cell will have something in it. Column two has a header of "Use Record", this column will have values of 1, 0 or it will be empty. What I want to do is find Use "Record" and then work my way down the column and if the value = 0 then make column 1 text = "Dropped" then bold the whole row. How do I do the loop since column 2 could have a blank cell and there still could be rows in the spreasheet? Thanks Mike Col1 Use Record Col2 a 1 b 0 c d 0 e 0 f g 1 h |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
column loop problem??
Dim rng as Range, cell as Range
set rng = Range(cells(1,2),Cells(rows.count,2).end(xlup)) for each cell in rng Change the 1 in 1,2 to indicate the row you want to start in. Or if that is what you mean - that you want to find the word Record in column 2 Dim rng1 as Range, rng as Range, cell as Range set rng1 = Columns(2).find("Record", Lookat:=xlPart, Lookin:=xlValues) if not rng1 is nothing then set rng = Range(rng1,Cells(rows.count,2).end(xlup)) for each cell in rng -- Regards, Tom Ogilvy "Mike" wrote in message ... I have a spreadsheet with 3 columns. Column 1 will have various text and will each cell will have something in it. Column two has a header of "Use Record", this column will have values of 1, 0 or it will be empty. What I want to do is find Use "Record" and then work my way down the column and if the value = 0 then make column 1 text = "Dropped" then bold the whole row. How do I do the loop since column 2 could have a blank cell and there still could be rows in the spreasheet? Thanks Mike Col1 Use Record Col2 a 1 b 0 c d 0 e 0 f g 1 h |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
column loop problem??
Thanks for the reply. I'll try and figure out what it's doing.
Here is what I had. I just stuck the loop 100 times to get it moving. Sub Use_Record_Drop() 'Find "Use Record" Cells.Find(What:="Use Record", After:=ActiveCell, LookIn:=xlFormulas, _ Lookat:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate ActiveCell.Offset(1, 0).Activate Dim x For x = 1 To 100 If ActiveCell.Text = "0" Then ActiveCell.Offset(0, -1).Activate ActiveCell.Value = "Dropped" ActiveCell.Offset(0, 1).Activate 'Move cursor down ActiveCell.Offset(1, 0).Activate Else 'Move cursor down ActiveCell.Offset(1, 0).Activate End If Next "Tom Ogilvy" wrote: Dim rng as Range, cell as Range set rng = Range(cells(1,2),Cells(rows.count,2).end(xlup)) for each cell in rng Change the 1 in 1,2 to indicate the row you want to start in. Or if that is what you mean - that you want to find the word Record in column 2 Dim rng1 as Range, rng as Range, cell as Range set rng1 = Columns(2).find("Record", Lookat:=xlPart, Lookin:=xlValues) if not rng1 is nothing then set rng = Range(rng1,Cells(rows.count,2).end(xlup)) for each cell in rng -- Regards, Tom Ogilvy "Mike" wrote in message ... I have a spreadsheet with 3 columns. Column 1 will have various text and will each cell will have something in it. Column two has a header of "Use Record", this column will have values of 1, 0 or it will be empty. What I want to do is find Use "Record" and then work my way down the column and if the value = 0 then make column 1 text = "Dropped" then bold the whole row. How do I do the loop since column 2 could have a blank cell and there still could be rows in the spreasheet? Thanks Mike Col1 Use Record Col2 a 1 b 0 c d 0 e 0 f g 1 h |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Loop Problem | Excel Programming | |||
Problem adding charts using Do-Loop Until loop | Excel Programming | |||
Problem with Do Loop and If | Excel Programming | |||
For...Each Loop Problem | Excel Programming | |||
loop problem | Excel Programming |