Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Retaining Changing Font Color in Cell

I set out to do what I thought would be a simple macro and hit not one, but
two walls. The macro was to simply tack the date on to the current (text)
contents of a cell and then leave that cell open (i.e. in edit mode) with the
cursor ready for input after the date. The two walls that I hit were (1)
leaving the cell open for input, and (2) retaining the changing font color
formatting of the cell (often phrases or sentences in the cell are different
colors from the rest).

Are there reasonably easy ways around these two problems? I thought of
using a simple form with just a text box instead of allowing the editing
directly in the cell. That could solve the first problem but I still have
the second.

Thanks,
Will
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default Retaining Changing Font Color in Cell

Will,

For problem 2, check out the following link and see if it helps in your
case. I did a search on "change font color part of text" and got a few
good results.

Alan



http://groups.google.com/group/micro...of+text&qt_g=1

roadkill wrote:
I set out to do what I thought would be a simple macro and hit not one, but
two walls. The macro was to simply tack the date on to the current (text)
contents of a cell and then leave that cell open (i.e. in edit mode) with the
cursor ready for input after the date. The two walls that I hit were (1)
leaving the cell open for input, and (2) retaining the changing font color
formatting of the cell (often phrases or sentences in the cell are different
colors from the rest).

Are there reasonably easy ways around these two problems? I thought of
using a simple form with just a text box instead of allowing the editing
directly in the cell. That could solve the first problem but I still have
the second.

Thanks,
Will


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default Retaining Changing Font Color in Cell

This might be work for you. Put the code in a module or a CommandButton
etc. This inserts the text for you, but you can use existing text too.

Sub ColourAndEdit()
Sheets(1).Range("A1").Select
Selection.Value = "Black RED Black " & Date

With ActiveCell.Characters(Start:=7, Length:=3).Font
.Name = "Arial"
.ColorIndex = 3
End With

Application.SendKeys ("{F2}")
End Sub

As much as I distrust and dislike SendKeys it has got me out of many a
situation where I can't do things 'properly'!

The worksheet must be active/visible during execution for this to work.

wrote:
Will,

For problem 2, check out the following link and see if it helps in your
case. I did a search on "change font color part of text" and got a few
good results.

Alan



http://groups.google.com/group/micro...of+text&qt_g=1

roadkill wrote:
I set out to do what I thought would be a simple macro and hit not one, but
two walls. The macro was to simply tack the date on to the current (text)
contents of a cell and then leave that cell open (i.e. in edit mode) with the
cursor ready for input after the date. The two walls that I hit were (1)
leaving the cell open for input, and (2) retaining the changing font color
formatting of the cell (often phrases or sentences in the cell are different
colors from the rest).

Are there reasonably easy ways around these two problems? I thought of
using a simple form with just a text box instead of allowing the editing
directly in the cell. That could solve the first problem but I still have
the second.

Thanks,
Will


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Retaining Changing Font Color in Cell

Thanks. I think the F2 thing will take care of putting the cell in edit
mode. As for the colors, I'm not sure yet but will work on using your
suggestion.
Will

"JakeyC" wrote:

This might be work for you. Put the code in a module or a CommandButton
etc. This inserts the text for you, but you can use existing text too.

Sub ColourAndEdit()
Sheets(1).Range("A1").Select
Selection.Value = "Black RED Black " & Date

With ActiveCell.Characters(Start:=7, Length:=3).Font
.Name = "Arial"
.ColorIndex = 3
End With

Application.SendKeys ("{F2}")
End Sub

As much as I distrust and dislike SendKeys it has got me out of many a
situation where I can't do things 'properly'!

The worksheet must be active/visible during execution for this to work.

wrote:
Will,

For problem 2, check out the following link and see if it helps in your
case. I did a search on "change font color part of text" and got a few
good results.

Alan



http://groups.google.com/group/micro...of+text&qt_g=1

roadkill wrote:
I set out to do what I thought would be a simple macro and hit not one, but
two walls. The macro was to simply tack the date on to the current (text)
contents of a cell and then leave that cell open (i.e. in edit mode) with the
cursor ready for input after the date. The two walls that I hit were (1)
leaving the cell open for input, and (2) retaining the changing font color
formatting of the cell (often phrases or sentences in the cell are different
colors from the rest).

Are there reasonably easy ways around these two problems? I thought of
using a simple form with just a text box instead of allowing the editing
directly in the cell. That could solve the first problem but I still have
the second.

Thanks,
Will



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
Font color changing by itself EJamison Excel Discussion (Misc queries) 2 September 18th 08 05:34 PM
Changing Font color automatically when Cell Format is Percentage Teljon Excel Worksheet Functions 1 May 18th 08 06:39 AM
Changing Font color based on font type or size John Excel Discussion (Misc queries) 2 February 7th 08 12:50 AM
changing font color of cell content Donald Stockton Excel Programming 8 March 9th 06 05:50 PM
Changing Cell Font and Color Issue, RitaG Excel Programming 7 April 1st 05 12:29 AM


All times are GMT +1. The time now is 05:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"