在 Excel 上如何实现以下效果?

nXerrors 2003-08-21 06:21:22
单元格 A1 ,内容是123,字体为 字体一
单元格 B1 ,内容是456,字体为 字体二
要求在 C1 中实现以下效果:
内容是123456,其中“123”字体一,“456”为字体二。
各位大虾救救我吧!!!
...全文
38 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
cloudtarget 2003-09-13
  • 打赏
  • 举报
回复
学习
sayboy 2003-09-02
  • 打赏
  • 举报
回复
Sub 宏1()
'
' 宏1 Macro
' tangluxin 记录的宏 2003-9-1
'

'
Range("C1").Select
ActiveCell.FormulaR1C1 = ""
Range("A1").Select
ActiveCell.FormulaR1C1 = "我爱你"
Range("C1").Select
ActiveCell.FormulaR1C1 = "我爱你"
Range("B1").Select
ActiveCell.FormulaR1C1 = "是真的"
Range("C1").Select
ActiveCell.FormulaR1C1 = "我爱你是真的"
Range("C1").Select
ActiveCell.FormulaR1C1 = "我爱你是真的"
With ActiveCell.Characters(Start:=1, Length:=3).Font
.Name = "黑体"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With ActiveCell.Characters(Start:=4, Length:=3).Font
.Name = "新宋体"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("B1").Select
ActiveCell.FormulaR1C1 = "是真的"
With ActiveCell.Characters(Start:=1, Length:=3).Font
.Name = "楷体_GB2312"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("C1").Select
ActiveCell.FormulaR1C1 = "我爱你是真的"
With ActiveCell.Characters(Start:=1, Length:=3).Font
.Name = "黑体"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With ActiveCell.Characters(Start:=4, Length:=3).Font
.Name = "楷体_GB2312"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("C3").Select
Application.Goto Reference:="宏1"
End Sub


我想睡觉了,应该好好看看宏,对EXCEL的编程非常有用
VBA趋于完美!
大雄 2003-09-01
  • 打赏
  • 举报
回复
如果字符长度固定,你按我上面说的录制一个宏就可以了,我看过录制的宏是以字符串长度来分别设置字体,也就是说前面三个字符是字体一,后面三个设置字体二。
nXerrors 2003-08-31
  • 打赏
  • 举报
回复
请问如何写宏 (如果字符串“456”前均有字符“4”和后均有字符“6”)??
jessiebian 2003-08-26
  • 打赏
  • 举报
回复
TO:大雄,请问学习宏录制,要从哪里开始?如果看到请回信:jessiebian@21cn.com
zhumm 2003-08-24
  • 打赏
  • 举报
回复
top
lxhhqc 2003-08-24
  • 打赏
  • 举报
回复
一定要先将其全设为文本格式
大雄 2003-08-23
  • 打赏
  • 举报
回复
用宏可以实现。如果单元格不多数字长度固度你可以先输入123、456,点击“工具”->宏->录制宏,然后把定位单元格、设置文本格式、设置后三位为字体二的过程录制下来,再放到工具栏上随时点击或者放到Worksheet_SelectionChange事件里自动执行。如果数字长度不定那就要自已写宏了代码了。
nXerrors 2003-08-23
  • 打赏
  • 举报
回复
top
bxjgood66 2003-08-23
  • 打赏
  • 举报
回复
楼上说的好!
nXerrors 2003-08-22
  • 打赏
  • 举报
回复
top
jy2004 2003-08-21
  • 打赏
  • 举报
回复
通过合并可以实现
niece 2003-08-21
  • 打赏
  • 举报
回复
先设置好 一和二

CONCATENATE(A1,B1)
EdwardZhou 2003-08-21
  • 打赏
  • 举报
回复
同一单元格可以设置多种字体和格式,但仅限于文本格式;
数值、日期值等和用公式计算处理得到的内容都无法设置成多种字体和格式。

建议您还是用 C1 和 D1 来分别链接 A1 和 B1 的内容并设置成不同的字体、格式,而将下面的 C2 和 D2、C3 和 D3、C4 和 D4 …… 进行单元格合并,这样可以变通达到您的目的。
yappies 2003-08-21
  • 打赏
  • 举报
回复
非也非也,同一单元格可以使用两种以上的字体(字型、大小),不过你要分别选中各个文字,分别设置即可,至于和在一起,我没试过。
hxcom 2003-08-21
  • 打赏
  • 举报
回复
=CONCATENATE(A1,B1),可以实现!
但EXCEL同一单元格只能使用同一字体!


祝你好运!


===========================
授之以鱼不如授之以渔
===========================

6,210

社区成员

发帖
与我相关
我的任务
社区描述
Microsoft Office应用
社区管理员
  • Microsoft Office应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧