Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default color on text in a cell

How do u modify data in a cell with different color text thru VBA.
I want to append data with a different color to the existing cell.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default color on text in a cell

Hi LookingGood,

From the little detail that you provide, it would seem that Excel's
Conditional Forma ( Menus | Format | Conditional Formatting...) option
would be appropriate

For more information see Debra Dalgleish at:

http://www.contextures.com/xlCondFormat01.html

If you need to automate this process, turn on the macro recorder while you
perform the operation manually. The resultant code may be edited to allow
for more general application.

If you experience problems with such editing, post back with the problematic
code.


---
Regards,
Norman


"LookingGood" wrote in message
...
How do u modify data in a cell with different color text thru VBA.
I want to append data with a different color to the existing cell.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default color on text in a cell

Sorry for providing not enough info.

Okay, cell 'A1' is null, a user (buyer) enters information using a Userform
screen which updates cell A1, because the user is a buyer, his/her text will
be in Red
If another user (stores) enters information using the same Userform screen,
and updates cell 'A1', his/her text would be in Blue and so forth.

Using the code below, changes all text to Red

Dim MyText As String
Dim MyTextCnt As Integer, MyRespCnt As Integer

MyText = Range("L" & MyRow).Value
MyTextCnt = Len(MyText)
MyRespCnt = Len(txtResponse.Value) + 1

Range("L" & MyRow).Value = MyText & Chr(10) & txtResponse.Value
'
Range("L" & MyRow).Select
With ActiveCell.Characters(Start:=MyTextCnt + 1, Length:=MyRespCnt).Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 3
End With

I would like to keep the reply with different colors, can u or anyone
help.......
"Norman Jones" wrote:

Hi LookingGood,

From the little detail that you provide, it would seem that Excel's
Conditional Forma ( Menus | Format | Conditional Formatting...) option
would be appropriate

For more information see Debra Dalgleish at:

http://www.contextures.com/xlCondFormat01.html

If you need to automate this process, turn on the macro recorder while you
perform the operation manually. The resultant code may be edited to allow
for more general application.

If you experience problems with such editing, post back with the problematic
code.


---
Regards,
Norman


"LookingGood" wrote in message
...
How do u modify data in a cell with different color text thru VBA.
I want to append data with a different color to the existing cell.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default color on text in a cell

Dim i
With ActiveCell
i = Len(.Value)
.Value = .Value & " text in red"
.Characters(i + 1, Len(.Value) - i).Font.ColorIndex = 3
End With


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"LookingGood" wrote in message
...
How do u modify data in a cell with different color text thru VBA.
I want to append data with a different color to the existing cell.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default color on text in a cell

Bob, thank you for your response.

I have used the code u have provided and i am still getting the same result
that I have originally.

Here the scenerio, I have manually enter 2 sentences into cell 'A1', the
first sentence, set the text to red whilst the 2nd with blue. I placed the
3rd sentence into cell A2 in Black text

Using your code, where u have 'text in red', replaced it bye referencing
cell A2 and changed the colorindex from 3 to 4
Ran the code, the result as follows
Sentences 1 & 2 in cell A1 changed all to blue, whilst the sentence cell A2
that appended to cell A1 show as green which is corrent.
Why did the sentence 1 change to blue?

Please help

"Bob Phillips" wrote:

Dim i
With ActiveCell
i = Len(.Value)
.Value = .Value & " text in red"
.Characters(i + 1, Len(.Value) - i).Font.ColorIndex = 3
End With


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"LookingGood" wrote in message
...
How do u modify data in a cell with different color text thru VBA.
I want to append data with a different color to the existing cell.






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
How do I fill one cell color with text html/rgb color from another thewris Excel Discussion (Misc queries) 2 January 22nd 09 12:24 AM
Can't format cell color/text color in Office Excel 2003 in fil Tony S Excel Discussion (Misc queries) 1 December 21st 07 01:41 PM
Make text color match cell color with macro? JoeSpareBedroom Excel Discussion (Misc queries) 1 June 26th 07 07:09 PM
Cell Fill Color and text color - changes for recipient Shadowman13 Excel Discussion (Misc queries) 0 March 8th 06 11:32 PM
Can't format cell color/text color in Office Excel 2003 in files . albertaman Excel Discussion (Misc queries) 0 February 16th 06 03:56 AM


All times are GMT +1. The time now is 04:18 AM.

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"