![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 11:51 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com