Change The Font In Excel 2007 Formula

October 28, 2010 at 13:19:57
Specs: Windows 7
I have to write a code. But I could not do a kind of.
I want to do, change the font of a cell in the row below.

For example;

| A | B | C |
-------------------------------------------------------------------------------------------
1 | Text A | Text B | =A1&CHAR(10)&B1
-------------------------------------------------------------------------------------------
2 | Text C | Text D | =A2&CHAR(10)&B2
-------------------------------------------------------------------------------------------

As a result

| C |
--------------------------------------------------------------
1 | Text A |
| Text B |
--------------------------------------------------------------
2 | Text C |
| Text D |
--------------------------------------------------------------

I want to do;

| C |
--------------------------------------------------------------
1 | Text A |
| Text B |
--------------------------------------------------------------
2 | Text C |
| Text D |
--------------------------------------------------------------

Waiting for your help.
Tanks.


See More: Change The Font In Excel 2007 Formula

Report •


#1
October 28, 2010 at 14:15:12
You've asked this question twice.

In the cell where you have your formula: =A1&CHAR(10)&B1
Word Wrap the cell.

Format
Alignment
Check the box next to Wrap Text.

See if that works.

MIKE

http://www.skeptic.com/


Report •

#2
October 28, 2010 at 15:11:24
I know that way.
I want to learn to change the font of the bottom line. To need to write code for it.
I do not know how to write code that.
Would you help me in writing code?
I'm sorry that I twice this topic.

Tanks.


Report •

#3
October 28, 2010 at 17:56:15
To change the font of a cell you will need VBA,
unfortunately my VBA skills are nill.
Perhaps some else will offer some code.
Sorry

MIKE

http://www.skeptic.com/


Report •

Related Solutions

#4
October 29, 2010 at 04:33:30
Thank you anyway.

Report •

#5
October 29, 2010 at 06:45:05
You can't change the font of "text" that is the result of a formula.

Since the text isn't really in the cell, there is no text to format.

This code will place the value displayed in C1 into D1 and then format D1 the way you want.

Since it uses the worksheet_Change event, it will run whenever a value in Column A or B is changed.

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim chrPos As Integer
'Was change made to Column 1 or 2?
  If Target.Column < 3 Then
'Copy value in C1 to "D" & Target.Row
    Range("D" & Target.Row) = Range("C" & Target.Row)
'Loop through characters in "D" & Target.Row looking for CHAR(10)
'When found, jump out of loop
      For chrPos = 1 To Len(Range("D" & Target.Row))
        If Asc(Mid(Range("D" & Target.Row).Value, chrPos, 1)) = 10 Then _
          GoTo myFormat
     Next
myFormat:
'Italicize the Bottom Line
    Range("D" & Target.Row).Characters(Start:=chrPos + 1, _
       Length:=Len(Range("D" & Target.Row))).Font.Italic = True
  End If
End Sub


Report •


Ask Question