本文介绍了使用Excel我试图在字符串'姓氏,名字'中加入姓氏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在excel中,我有姓氏的单元格和名字的第二个单元格。我试图用逗号分隔它们,但只有粗体字。我可以和他们一起加入他们,但每当我试着让其中一个名字变得大胆时,他们都会变得大胆。我有
尝试将姓氏单元加粗,然后将两个名字合并成一个单元格,但它们仍然全部变为粗体。

In excel I have cell for surname and a second cell for first name. I seek to join them together separated by a comma but to only have the surname in bold. I can join them together but everytime I try to make one of the names bold they all go bold. I have tried making the surname cell bold before joing the two names together into one cell but they still all turn Bold or not at all.

帮助

< [email protected]>

< [email protected]>

推荐答案

根据您的要求,我担心没有直接的方法可以实现。我建议你加粗组合的字符串文本,然后将你不想要的文本解开。你好b $ b

For your requirement, I am afraid there is no direct way to achieve. I suggest you bold the combined string text, and then unbold the text what you did not want.

这是一个简单的代码:

Here is a simple code:

Sub test()
       Dim s1 As String
    Dim s2 As String
     s1 = Range("C1").Text
     s2 = Range("D1").Text
    ActiveCell.Value = s1 & "," & s2
With ActiveCell.Characters(Start:=1, Length:=Len(s1)).Font
        .Name = "??"
        .FontStyle = "Bold"
        .Size = 11
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
        .ThemeFont = xlThemeFontMinor
    End With
    With ActiveCell.Characters(Start:=4, Length:=Len(s2)).Font
        .Name = "??"
        .FontStyle = "Regular"
        .Size = 11
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
        .ThemeFont = xlThemeFontMinor
End With
End Sub

最好的问候,

Best Regards,

爱德华


这篇关于使用Excel我试图在字符串'姓氏,名字'中加入姓氏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 19:14