Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Function: Join Cells with Format

Hi,

Could you help me?
How to join cells with different fonts?
For example, I have:
A1 = "2" (Normal)
B1 = "10" (Superscript)
C1 = "=1024" (Normal)
and I want to see 2^10=1024 (where "^10" - is "10" in
superscript). So, can I write:
D1 = SomeFuncJointWithFormats(A1, B1, C1)?

Thank you for help,
Alexey E. Kolmyk

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Function: Join Cells with Format

A worksheet function can only return a value - it can't do
formatting. You could instead use an event macro: put this in the
worksheet code module (right-click on the worksheet tab and choose
View Code):

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Not Intersect(Range("A1:C1"), Target) Is Nothing Then
With Range("A1:D1")
Application.EnableEvents = False
.Item(4).Value = .Item(1) & .Item(2) & .Item(3)
.Item(4).Characters(Len(.Item(1)) + 1, _
Len(.Item(2))).Font.Superscript = True
Application.EnableEvents = True
End With
End If
End Sub


In article ,
"Alexey E. Kolmyk" wrote:

Hi,

Could you help me?
How to join cells with different fonts?
For example, I have:
A1 = "2" (Normal)
B1 = "10" (Superscript)
C1 = "=1024" (Normal)
and I want to see 2^10=1024 (where "^10" - is "10" in
superscript). So, can I write:
D1 = SomeFuncJointWithFormats(A1, B1, C1)?

Thank you for help,
Alexey E. Kolmyk

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Function: Join Cells with Format

Hi,

for me it only works when the value in D4 is text.
I changed it as follows:

........
.Item(4).Value = .Item(1) & .Item(2) & "="&.Item(3)
........
which formats it automatically to text

Best regards
Wolf

wlamik<atgmx.net

-----Original Message-----
A worksheet function can only return a value - it can't

do
formatting. You could instead use an event macro: put

this in the
worksheet code module (right-click on the worksheet tab

and choose
View Code):

Private Sub Worksheet_Change(ByVal Target As

Excel.Range)
If Not Intersect(Range("A1:C1"), Target) Is

Nothing Then
With Range("A1:D1")
Application.EnableEvents = False
.Item(4).Value = .Item(1) & .Item(2)

& .Item(3)
.Item(4).Characters(Len(.Item(1)) + 1, _
Len(.Item(2))).Font.Superscript

= True
Application.EnableEvents = True
End With
End If
End Sub


In article ,
"Alexey E. Kolmyk" wrote:

Hi,

Could you help me?
How to join cells with different fonts?
For example, I have:
A1 = "2" (Normal)
B1 = "10" (Superscript)
C1 = "=1024" (Normal)
and I want to see 2^10=1024 (where "^10" - is "10" in
superscript). So, can I write:
D1 = SomeFuncJointWithFormats(A1, B1, C1)?

Thank you for help,
Alexey E. Kolmyk

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Function: Join Cells with Format

Since the OP wrote

C1 = "=1024"

indicating that C1 *was* text, your solution would produce an extra
= sign.

There are, of course, a variety of ways to use conditionals to make
this more flexible. Both your solution and mine fail if LEN(B1)=0.



In article ,
"Wolf" wrote:

for me it only works when the value in D4 is text.
I changed it as follows:

.......
.Item(4).Value = .Item(1) & .Item(2) & "="&.Item(3)
.......
which formats it automatically to text

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
join data in multiple cells when adjoining cells match criteria ?? angiec50 Excel Worksheet Functions 1 October 6th 09 10:27 AM
Join tables like inner join in Access ryanp Excel Discussion (Misc queries) 2 July 18th 08 03:35 PM
How do I join a range of cells? BPB Excel Discussion (Misc queries) 1 April 12th 06 06:47 PM
Join three columns containing phone number and format as (000) 000 Sharon Barr Excel Discussion (Misc queries) 5 March 10th 06 10:37 PM
join cells for a vlookup Jim Excel Worksheet Functions 1 January 26th 06 03:09 AM


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