Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Set certain rows to Bold

I want to step through all the used rows, and for those rows that have a
certain string contained in column B I want to set the row to bold. How
could I write a macro to do that?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Set certain rows to Bold

Look in vba HELP for FINDNEXT. There is an excellent example you can modify

--
Don Guillett
SalesAid Software

"jerry chapman" wrote in message
. com...
I want to step through all the used rows, and for those rows that have a
certain string contained in column B I want to set the row to bold. How
could I write a macro to do that?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Set certain rows to Bold

I looked in vba help for findnext, and it talked about a record set. I don't
see the relevenct to my question.
"Don Guillett" wrote in message
...
Look in vba HELP for FINDNEXT. There is an excellent example you can

modify

--
Don Guillett
SalesAid Software

"jerry chapman" wrote in message
. com...
I want to step through all the used rows, and for those rows that have a
certain string contained in column B I want to set the row to bold. How
could I write a macro to do that?






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Set certain rows to Bold

Wrong FindNext. Here is the example code referred to:

Example
This example finds all cells in the range A1:A500 that contain the value 2
and changes their values to 5.

With Worksheets(1).Range("a1:a500")
Set c = .Find(2, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Value = 5
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

--
Regards,
Tom Ogilvy

"jerry chapman" wrote in message
om...
I looked in vba help for findnext, and it talked about a record set. I

don't
see the relevenct to my question.
"Don Guillett" wrote in message
...
Look in vba HELP for FINDNEXT. There is an excellent example you can

modify

--
Don Guillett
SalesAid Software

"jerry chapman" wrote in message
. com...
I want to step through all the used rows, and for those rows that have

a
certain string contained in column B I want to set the row to bold.

How
could I write a macro to do that?








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Set certain rows to Bold

I don't think that really addresses my problem. I had simplified it a
little. So let me restate it.
I want to work on each row individually. In each row I want to check for a
different sequence of character in three different column. If the required
sequence is found in any of the three columns, I want to set all the columns
in that to Bold.
"Tom Ogilvy" wrote in message
...
Wrong FindNext. Here is the example code referred to:

Example
This example finds all cells in the range A1:A500 that contain the value 2
and changes their values to 5.

With Worksheets(1).Range("a1:a500")
Set c = .Find(2, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Value = 5
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

--
Regards,
Tom Ogilvy

"jerry chapman" wrote in message
om...
I looked in vba help for findnext, and it talked about a record set. I

don't
see the relevenct to my question.
"Don Guillett" wrote in message
...
Look in vba HELP for FINDNEXT. There is an excellent example you can

modify

--
Don Guillett
SalesAid Software

"jerry chapman" wrote in message
. com...
I want to step through all the used rows, and for those rows that

have
a
certain string contained in column B I want to set the row to bold.

How
could I write a macro to do that?












  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Set certain rows to Bold

Ahhh. But you could use that shell to seach through each of the 3 columns. If
you find a match, you just bold the row.

Option Explicit
Sub testme01()

Dim myCols As Variant
Dim iCtr As Long
Dim WhatToFind As Variant
Dim c As Range
Dim FirstAddress As String

myCols = Array("a", "E", "J")
WhatToFind = Array("abcd", "efgh", "ijkl")


For iCtr = LBound(myCols) To UBound(myCols)
FirstAddress = ""
With Worksheets("sheet1").Range(myCols(iCtr) & "1").EntireColumn
Set c = .Cells.Find(what:=WhatToFind(iCtr), _
after:=.Cells(.Cells.Count), _
LookIn:=xlFormulas, _
lookat:=xlPart, _
searchdirection:=xlNext)
If Not c Is Nothing Then
FirstAddress = c.Address
Do
c.EntireRow.Font.Bold = True
Set c = .FindNext(c)
Loop While Not c Is Nothing _
And c.Address < FirstAddress
End If
End With
Next iCtr
End Sub

Watch out for that .find command. I looked for it in any part of the cell
(xlpart vs xlwhole).

You could cycle through each of the rows and use instr() to look for a match,
but .find's can be a lot faster.



jerry chapman wrote:

I don't think that really addresses my problem. I had simplified it a
little. So let me restate it.
I want to work on each row individually. In each row I want to check for a
different sequence of character in three different column. If the required
sequence is found in any of the three columns, I want to set all the columns
in that to Bold.
"Tom Ogilvy" wrote in message
...
Wrong FindNext. Here is the example code referred to:

Example
This example finds all cells in the range A1:A500 that contain the value 2
and changes their values to 5.

With Worksheets(1).Range("a1:a500")
Set c = .Find(2, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Value = 5
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

--
Regards,
Tom Ogilvy

"jerry chapman" wrote in message
om...
I looked in vba help for findnext, and it talked about a record set. I

don't
see the relevenct to my question.
"Don Guillett" wrote in message
...
Look in vba HELP for FINDNEXT. There is an excellent example you can
modify

--
Don Guillett
SalesAid Software

"jerry chapman" wrote in message
. com...
I want to step through all the used rows, and for those rows that

have
a
certain string contained in column B I want to set the row to bold.

How
could I write a macro to do that?









--

Dave Peterson
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
Hide only rows that are not bold? kczmatthews Excel Discussion (Misc queries) 2 July 16th 08 06:32 PM
Counting bold cells in table rows John Excel Worksheet Functions 2 June 11th 08 02:52 AM
Show or hide rows when text is bold or italic Sophisticated Penguin Excel Programming 4 December 1st 04 09:45 AM
Count Bold Numbers in Range - multiple rows QTE[_6_] Excel Programming 1 June 8th 04 04:36 PM
Ideal Code deleting rows/based on bold text Samm Excel Programming 1 April 9th 04 03:20 AM


All times are GMT +1. The time now is 11:26 AM.

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

About Us

"It's about Microsoft Excel"