Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
a a is offline
external usenet poster
 
Posts: 1
Default Set smallest cell in row,col as BOLD

I want to have a macro that will set the smallest number in a row (or
in a column) of selected text to BOLD. For example, with A1 = 1,B1 =
2, C1 = 3, D1 = 4 I want the macro to set Cell A1 to be bolded.

Art
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Set smallest cell in row,col as BOLD

Art,
This macro will conditional format the selected range to make minimum value
bold.

Sub BoldMinimum()

Selection.FormatConditions.Delete
Selection.FormatConditions.Add _
Type:=xlExpression, Formula1:= _
"=" & ActiveCell.Address(0, 0) & _
"=Min(" & Selection.Address & ")"
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
End With

End Sub

HTH
Cecil

<artengel123 (a) earth (removethis) link.net wrote in message
...
I want to have a macro that will set the smallest number in a row (or
in a column) of selected text to BOLD. For example, with A1 = 1,B1 =
2, C1 = 3, D1 = 4 I want the macro to set Cell A1 to be bolded.

Art



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Set smallest cell in row,col as BOLD

These two subs will apply conditional formatting on the either the selected
column or row to accomplish what you requested. Much later than Cecil, but
I spent so much time I had to at least send them off! If you add to the row
or column, you will need to re-run to extend the formatting to these cells.

Sub format_col()

Dim last_col As Long
Dim col_range As Range

last_col = Selection.Column
Set col_range = Range(Cells(1, last_col), Cells(Cells(Rows.Count,
last_col).End(xlUp).Row, last_col))
With col_range
.FormatConditions.Delete
.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual,
Formula1:="=MIN(" & col_range.Address & ")"
.FormatConditions(1).Font.Bold = True
End With

End Sub

Sub format_row()

Dim last_row As Long
Dim row_range As Range

last_row = Selection.Row

Set row_range = Range(Cells(last_row, 1), Cells(last_row, Cells(last_row,
Columns.Count).End(xlToLeft).Column))
With row_range
.FormatConditions.Delete
.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual,
Formula1:="=MIN(" & row_range.Address & ")"
.FormatConditions(1).Font.Bold = True
End With

End Sub

hth,

Doug Glancy

<artengel123 (a) earth (removethis) link.net wrote in message
...
I want to have a macro that will set the smallest number in a row (or
in a column) of selected text to BOLD. For example, with A1 = 1,B1 =
2, C1 = 3, D1 = 4 I want the macro to set Cell A1 to be bolded.

Art



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
bold text of referenced cell show in formula cell zabcikranch Excel Worksheet Functions 1 February 2nd 10 07:42 PM
Alphabetically list of last names: BOLD, not bold Lerner Excel Discussion (Misc queries) 16 March 1st 09 07:46 PM
Alphabetically list of names BOLD and NOT bold Lerner Excel Discussion (Misc queries) 13 March 1st 09 02:37 PM
Join bold and non-bold text in one cell bkincaid Excel Discussion (Misc queries) 3 March 21st 06 12:58 AM
How can i test a cell for bold style in a cell (Excel 2003)? Mike A. Excel Worksheet Functions 2 March 6th 06 07:23 PM


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

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"