Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Loop Problem Cody Excel Programming 0 July 28th 05 08:12 PM
Problem adding charts using Do-Loop Until loop Chris Bromley[_2_] Excel Programming 2 May 23rd 05 01:31 PM
Problem with Do Loop and If aehan Excel Programming 7 April 8th 05 01:01 AM
For...Each Loop Problem SuperJas Excel Programming 4 April 2nd 04 05:01 AM
loop problem joao Excel Programming 4 November 6th 03 02:01 PM


All times are GMT +1. The time now is 07:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"