My Assistant
![]() ![]() |
|
|
May 1 2007, 01:22 PM
Post
#1
|
|
|
UtterAccess Ruler Posts: 4,254 From: Downey, CA |
I am working with a spreadsheet where I'm updating values, and want the font set to bold when/if the value in a cell changes. I may have used the code shown below from Crystal a few months back, but forgot how to apply it. Any ideas how to use this code ? It's not working for me, and I can't find what I'm doing wrong - I searched UA for samples of the Worsheet_Change event coding, but found nothing.
Sub BoldWhenDifferent() Dim mCol As Long _ , mRow As Long _ , mValue mCol = ActiveCell.Column 'first value is bolded ActiveCell.Font.Bold = True mValue = ActiveCell 'assumes you are in the first row of data For mRow = ActiveCell.Row To ActiveSheet.UsedRange.Rows.Count If Not IsError(Cells(mRow, mCol)) Then If Cells(mRow, mCol) <> mValue Then Cells(mRow, mCol).Font.Bold = True mValue = Cells(mRow, mCol) End If Next mRow End Sub |
|
|
|
May 1 2007, 02:51 PM
Post
#2
|
|
|
Retired Moderator Posts: 10,959 From: Prague,CZ / Kiev,UA |
Hi Steve,
not sure what you are after, this sounds rather like a task for conditional format. This will change any cell in ANY sheet you change to bold, if you really must: CODE Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) Target.Font.Bold = True End Sub The code goes into ThisWorkbook module. Martin |
|
|
|
May 1 2007, 03:46 PM
Post
#3
|
|
|
UtterAccess Ruler Posts: 4,254 From: Downey, CA |
Martin,
Thanks! Steve |
|
|
|
May 1 2007, 04:26 PM
Post
#4
|
|
|
UtterAccess Ruler Posts: 4,254 From: Downey, CA |
Martin,
That is a really slick piece of code - talk about a small block of code - I know a lot of people might never need something like that, but this will come in handy - thanks again (IMG:http://www.utteraccess.com/forum/style_emoticons/default/cool.gif) Steve |
|
|
|
May 2 2007, 01:03 AM
Post
#5
|
|
|
Retired Moderator Posts: 10,959 From: Prague,CZ / Kiev,UA |
|
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 19th June 2013 - 12:40 AM |