Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Bolding a Cell under certain conditions

I am looking for a program/function that takes in a selected column,
and bolds any cell in that column where the cell above or the cell
below has the same value.

The worksheet is already sorted on the selected column.

Thanks for any pointers or suggestions for Excel 2007.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Bolding a Cell under certain conditions

This code will scan Col.A and bold any cell that has same value above and
below it. You will have to change it to which ever Column you need.

Option Explicit

Sub BoldCells()

Dim i As Long

For i = 2 To Cells(Rows.Count, "A").End(xlUp).Row
If Cells(i - 1, "A").Value = Cells(i + 1, "A").Value Then
Cells(i, "A").Font.Bold = True
End If
Next i

End Sub

Hope this helps! If so, click "YES" below.
--
Cheers,
Ryan


"DennyP" wrote:

I am looking for a program/function that takes in a selected column,
and bolds any cell in that column where the cell above or the cell
below has the same value.

The worksheet is already sorted on the selected column.

Thanks for any pointers or suggestions for Excel 2007.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Bolding a Cell under certain conditions

On Wed, 24 Sep 2008 16:32:06 -0700 (PDT), DennyP wrote:

I am looking for a program/function that takes in a selected column,
and bolds any cell in that column where the cell above or the cell
below has the same value.

The worksheet is already sorted on the selected column.

Thanks for any pointers or suggestions for Excel 2007.


Use conditional formatting (on the Home tab)

To apply this to C2:C10000

"Use a formula to determine which cells to format"

=OR(OFFSET(C2,-1,0)=C2,OFFSET(C2,1,0)=C2)

Then, in the CF Rules Manager, ensure the format applies to

=$C$2:$C$10000

--ron
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Bolding a Cell under certain conditions


Thanks for the suggestions. I really appreciate it and I've learned a
lot from them.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Bolding a Cell under certain conditions

I made a slight change because I needed the bold to occur if the row
above or below was the same.

Sub BoldCells()
Dim i As Long
For i = 2 To Cells(Rows.Count, "A").End(xlUp).Row
If (Cells(i - 1, "A").Value = Cells(i, "A").Value) Or (Cells(i
+ 1, "A").Value = Cells(i, "A").Value) Then
Cells(i, "A").Font.Bold = True
End If
Next i
End Sub

On Sep 24, 7:01*pm, RyanH wrote:
This code will scan Col.A and bold any cell that has same value above and
below it. *You will have to change it to which ever Column you need.

Option Explicit

Sub BoldCells()

Dim i As Long

* * For i = 2 To Cells(Rows.Count, "A").End(xlUp).Row
* * * * If Cells(i - 1, "A").Value = Cells(i + 1, "A").Value Then
* * * * * * Cells(i, "A").Font.Bold = True
* * * * End If
* * Next i

End Sub

Hope this helps! *If so, click "YES" below.
--
Cheers,
Ryan

"DennyP" wrote:
I am looking for a program/function that takes in a selected column,
and bolds any cell in that column where the cell above or the cell
below has the same value.


The worksheet is already sorted on the selected column.


Thanks for any pointers or suggestions for Excel 2007.


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
Countif Conditions - Use of conditions that vary by cell value JonTarg Excel Discussion (Misc queries) 1 May 30th 08 01:21 PM
Bolding using VBA Brad Excel Programming 7 March 6th 08 02:33 PM
Bolding variable cell JOUIOUI Excel Programming 5 September 16th 06 08:33 PM
Bolding Specific Cell Formula Question bodhisatvaofboogie Excel Discussion (Misc queries) 1 May 19th 06 03:06 PM
Bolding Dale[_12_] Excel Programming 2 September 30th 04 04:21 PM


All times are GMT +1. The time now is 08:35 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"