Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Don Don is offline
external usenet poster
 
Posts: 2
Default Formating Cells used code when worksheet opened

Hello, I'm passing data into an existing excel file using access. I want to
format the cells in the worksheet based on the text in each cell.

For Example:
Cell = Henry Smith*1
Cell = Henry Smith*3
Cell = Henry Smith*2
Cell = Henry Smith*3
Cell = Henry Smith*4
Cell = Henry Smith*5
Cell = Henry Smith*2

I want when the cell has *1 in it to set the color = red, when then *2 set
the cell color = blue, *3 set the cell color = yellow.

Is this possible.

Thanks

Don


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 694
Default Formating Cells used code when worksheet opened

you need to use some vba to set the cell color.

basically the process is

sub setcellcolor(r as range)

dim lcolorindex as long
select case right(r.value,2)
case "*1": lColorIndex = 3 ' red
case "*2": lColorIndex = 5 ' blue
case "*3":lColorIndex = 6 ' yellow
case else: lColorIndex = 0 ' nothing
end select
if lcolorindex 0 then
with r.Interior
.ColorIndex = lcolorindex
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
endif

end sub

'and you can call it with

sub setcolors
dim r as range
for each r in activesheet.usedrange
setcellcolor(r)
next r
end sub

hope this gets you started.
--
Hope this helps
Martin Fishlock
Please do not forget to rate this reply.


"Don" wrote:

Hello, I'm passing data into an existing excel file using access. I want to
format the cells in the worksheet based on the text in each cell.

For Example:
Cell = Henry Smith*1
Cell = Henry Smith*3
Cell = Henry Smith*2
Cell = Henry Smith*3
Cell = Henry Smith*4
Cell = Henry Smith*5
Cell = Henry Smith*2

I want when the cell has *1 in it to set the color = red, when then *2 set
the cell color = blue, *3 set the cell color = yellow.

Is this possible.

Thanks

Don



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 138
Default Formating Cells used code when worksheet opened

You can do this with Format = Conditional Formatting.

Example: Your format for A1 would look like this:
Condition1: Formula is.... =FIND("*1",A1) Format:red color
Condition2: Formula is.... =FIND("*2",A1) Format:bluecolor
etc.

Cheers,
Joerg Mochikun



"Don" wrote in message
...
Hello, I'm passing data into an existing excel file using access. I want

to
format the cells in the worksheet based on the text in each cell.

For Example:
Cell = Henry Smith*1
Cell = Henry Smith*3
Cell = Henry Smith*2
Cell = Henry Smith*3
Cell = Henry Smith*4
Cell = Henry Smith*5
Cell = Henry Smith*2

I want when the cell has *1 in it to set the color = red, when then *2 set
the cell color = blue, *3 set the cell color = yellow.

Is this possible.

Thanks

Don




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
Macro Help (Uppercase multiple ranges?) Ken Excel Discussion (Misc queries) 14 December 2nd 06 07:23 PM
Text formatting Kace Excel Worksheet Functions 1 September 18th 06 08:28 PM
How to merge cells in Word document by VBA code?? SiriS Excel Discussion (Misc queries) 0 May 4th 06 12:03 PM
Formating Worksheet Cells Kjacob54 Excel Discussion (Misc queries) 0 August 25th 05 03:21 PM
Linking cells in a worksheet to other worksheets in a workbook Dave Excel Discussion (Misc queries) 4 June 24th 05 06:18 PM


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