Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Preserving formatting in a formula.

I have a list of shipping codes and descriptions that is referenced in a
template. I need to copy the list and descriptions and add text to the
beginning of the description. The formula ="Customer "&B2" does this but I
want Customer to be Bold and Red. I tried putting Customer in its own set of
cells setting it to Bold, Red and using =B2&" "&C2 but it does not carry over
the formatting. How can I do this?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Preserving formatting in a formula.

You need to copy the formulas and paste/special/value elsewhere. The result
will be a text string. You can then format individual characters
--
Gary''s Student - gsnu200723
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Preserving formatting in a formula.


That would be a thought but I would have to highlight the first 10-15
characters of every cell one at a time and change the format.. I would have
to do this ~400 times... I just thought there might be an easy way to get the
formatting to carry over from one cell to the combined formula..

"Gary''s Student" wrote:

You need to copy the formulas and paste/special/value elsewhere. The result
will be a text string. You can then format individual characters
--
Gary''s Student - gsnu200723

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Preserving formatting in a formula.

How about changing the values right where they sit.

Select the range and run this macro:

Option Explicit
Sub testme()
Dim myCell As Range
Dim myRng As Range
Dim myPFX As String

myPFX = "Customer: "

Set myRng = Nothing
On Error Resume Next
Set myRng = Intersect(Selection, Selection.Cells.SpecialCells(xlTextValues))
On Error GoTo 0

If myRng Is Nothing Then
MsgBox "Select some cells with values!"
Exit Sub
End If

For Each myCell In myRng.Cells
With myCell
.Value = myPFX & .Text
With .Characters(Start:=1, Length:=Len(myPFX))
.Font.ColorIndex = 3
.Font.Bold = True
End With
End With
Next myCell

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

..colorindex = 3
is red in my workbook. It doesn't have to be that for your workbook (but
probably is).

NLiles wrote:

That would be a thought but I would have to highlight the first 10-15
characters of every cell one at a time and change the format.. I would have
to do this ~400 times... I just thought there might be an easy way to get the
formatting to carry over from one cell to the combined formula..

"Gary''s Student" wrote:

You need to copy the formulas and paste/special/value elsewhere. The result
will be a text string. You can then format individual characters
--
Gary''s Student - gsnu200723


--

Dave Peterson
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
MS Query from Excel - Preserving formatting, validation and Commen scott Excel Discussion (Misc queries) 2 November 27th 06 07:30 PM
Preserving Cell References Daiv Excel Discussion (Misc queries) 3 August 3rd 06 07:27 PM
Preserving customization donbowyer Setting up and Configuration of Excel 1 February 9th 06 09:52 AM
preserving format in a formula exceldoofus Excel Worksheet Functions 3 October 12th 05 06:27 PM
Preserving Formulas drwexcel Excel Discussion (Misc queries) 0 June 1st 05 05:23 PM


All times are GMT +1. The time now is 02:37 AM.

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"