Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Searching with Macros

Does anyone know how I can make a macro that will search
all cells within a preset range and change the font color
of all cells with a value of less than 20 to red while
leaving all other cells in the region with their normal
color?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Searching with Macros

Hi
why not use Conditional Format for this?. Simply select your data range
and goto 'Format - Conditional Format' for this

--
Regards
Frank Kabel
Frankfurt, Germany


Kura of Tyren wrote:
Does anyone know how I can make a macro that will search
all cells within a preset range and change the font color
of all cells with a value of less than 20 to red while
leaving all other cells in the region with their normal
color?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Searching with Macros

something like this

for each c in selection 'or range("a2:x234")
if c<20 then c.interior.colorindex=34 'change number to suit
next

--
Don Guillett
SalesAid Software

"Kura of Tyren" wrote in message
...
Does anyone know how I can make a macro that will search
all cells within a preset range and change the font color
of all cells with a value of less than 20 to red while
leaving all other cells in the region with their normal
color?



  #5   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Searching with Macros


-----Original Message-----
Does anyone know how I can make a macro that will search
all cells within a preset range and change the font

color
of all cells with a value of less than 20 to red while
leaving all other cells in the region with their normal
color?
.


This should work!

Sub FillCell()

'sets start area to check, in this example 1,1 or A1
startrow = 1
startcolumn = 1

'sets end of area to check, in this example 3,14 or c14
endcolumn = 3
endrow = 14

For x = startrow To endrow
For y = startcolumn To endcolumn
If Cells(x, y).Value < 20 Then
'sets colour to red
Cells(x, y).Interior.ColorIndex = 3
Else
'clears format
Cells(x, y).Interior.ColorIndex = xlNone
End If
Next y
Next x

End Sub


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
Searching, matching then searching another list based on the match A.S. Excel Discussion (Misc queries) 1 December 13th 06 05:08 AM
Macro Size Limit / open macros with macros? andycharger[_7_] Excel Programming 6 February 13th 04 02:00 PM
Macros not appearing in the Tools Macro Macros list hglamy[_2_] Excel Programming 5 October 24th 03 09:10 AM
Suppress the Disable Macros / Enable Macros Dialog Shoji Karai Excel Programming 5 September 24th 03 03:10 AM
List the Macros that can be executed from Tools-Macros Rob Bovey Excel Programming 1 July 10th 03 05:34 PM


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