セルの範囲内のすべての特定の単語を太字にする方法は?
Excelでは、 検索および置換 関数は、特定のテキストを検索し、セル全体に太字またはその他の書式を設定するのに役立ちます。 ただし、以下のスクリーンショットに示すように、セル全体ではなく、セル内の特定のテキストのみを太字にしようとしたことがありますか。
VBAコードを使用して、セルの範囲内のすべての特定の単語を太字にします
次のVBAコードは、セルコンテンツ内の特定のテキストのみを太字にするのに役立つ場合があります。次のようにしてください。
1。 を押し続けます Alt + F11 キーを押して アプリケーション向け Microsoft Visual Basic 窓。
2に設定します。 OK をクリックします。 インセット > モジュール、次のコードをに貼り付けます モジュール 窓。
VBAコード:セル範囲内の太字の特定のテキスト
Sub FindAndBold()
'Updateby Extendoffice 20160711
Dim xFind As String
Dim xCell As Range
Dim xTxtRg As Range
Dim xCount As Long
Dim xLen As Integer
Dim xStart As Integer
Dim xRg As Range
Dim xTxt As String
On Error Resume Next
If ActiveWindow.RangeSelection.Count > 1 Then
xTxt = ActiveWindow.RangeSelection.AddressLocal
Else
xTxt = ActiveSheet.UsedRange.AddressLocal
End If
Set xRg = Application.InputBox("Please select data range:", "Kutools for Excel", xTxt, , , , , 8)
If xRg Is Nothing Then Exit Sub
On Error Resume Next
Set xTxtRg = Application.Intersect(xRg.SpecialCells(xlCellTypeConstants, xlTextValues), xRg)
If xTxtRg Is Nothing Then
MsgBox "There are no cells with text"
Exit Sub
End If
xFind = Trim(Application.InputBox("What do you want to BOLD?", "Kutools for Excel", , , , , , 2))
If xFind = "" Then
MsgBox "No text was listed", vbInformation, "Kutools for Excel"
Exit Sub
End If
xLen = Len(xFind)
For Each xCell In xTxtRg
xStart = InStr(xCell.Value, xFind)
Do While xStart > 0
xCell.Characters(xStart, xLen).Font.Bold = True
xCount = xCount + 1
xStart = InStr(xStart + xLen, xCell.Value, xFind)
Loop
Next
If xCount > 0 Then
MsgBox "number of " & CStr(xCount) & " text be bolded!", vbInformation, "Kutools for Excel"
Else
MsgBox "Not find the specific text!", vbInformation, "Kutools for Excel"
End If
End Sub
3。 次に、 F5 このコードを実行するためのキーを押すと、太字にするデータ範囲を選択するように促すプロンプトボックスが表示されます。スクリーンショットを参照してください。
4。 そして、 OK、セルにのみ太字にしたい特定のテキストを入力するように促す別のボックスが表示されます。スクリーンショットを参照してください。
5。 テキストを入力したら、をクリックしてください OK ボタンをクリックすると、指定したすべてのテキストが選択した範囲で太字になります。スクリーンショットを参照してください。
最高のオフィス生産性向上ツール
🤖 | Kutools AI アシスタント: 以下に基づいてデータ分析に革命をもたらします。 インテリジェントな実行 | コードを生成 | カスタム数式の作成 | データを分析してグラフを生成する | Kutools関数を呼び出す... |
人気の機能: 重複を検索、強調表示、または識別する | 空白行を削除する | データを失わずに列またはセルを結合する | 数式なしのラウンド ... | |
スーパールックアップ: 複数の基準の VLookup | 複数の値の VLookup | 複数のシートにわたる VLookup | ファジールックアップ .... | |
詳細ドロップダウン リスト: ドロップダウンリストを素早く作成する | 依存関係のドロップダウン リスト | 複数選択のドロップダウンリスト .... | |
列マネージャー: 特定の数の列を追加する | 列の移動 | Toggle 非表示列の表示ステータス | 範囲と列の比較 ... | |
注目の機能: グリッドフォーカス | デザインビュー | ビッグフォーミュラバー | ワークブックとシートマネージャー | リソースライブラリ (自動テキスト) | 日付ピッカー | ワークシートを組み合わせる | セルの暗号化/復号化 | リストごとにメールを送信する | スーパーフィルター | 特殊フィルター (太字/斜体/取り消し線をフィルター...) ... | |
上位 15 のツールセット: 12 テキスト ツール (テキストを追加, 文字を削除する、...) | 50+ チャート 種類 (ガントチャート、...) | 40+ 実用的 式 (誕生日に基づいて年齢を計算する、...) | 19 挿入 ツール (QRコードを挿入, パスから画像を挿入、...) | 12 変換 ツール (数字から言葉へ, 通貨の換算、...) | 7 マージ&スプリット ツール (高度な結合行, 分割セル、...) | ... もっと |
Kutools for Excel で Excel スキルを強化し、これまでにない効率を体験してください。 Kutools for Excelは、生産性を向上させ、時間を節約するための300以上の高度な機能を提供します。 最も必要な機能を入手するにはここをクリックしてください...
Officeタブは、タブ付きのインターフェイスをOfficeにもたらし、作業をはるかに簡単にします
- Word、Excel、PowerPointでタブ付きの編集と読み取りを有効にする、パブリッシャー、アクセス、Visioおよびプロジェクト。
- 新しいウィンドウではなく、同じウィンドウの新しいタブで複数のドキュメントを開いて作成します。
- 生産性を 50% 向上させ、毎日何百回もマウス クリックを減らすことができます!
Sort comments by
#43948
This comment was minimized by the moderator on the site
0
0
#42492
This comment was minimized by the moderator on the site
0
0
#34902
This comment was minimized by the moderator on the site
Report
0
0
#30219
This comment was minimized by the moderator on the site
Report
0
0
#30220
This comment was minimized by the moderator on the site
Report
0
0
#25396
This comment was minimized by the moderator on the site
Report
0
0
#22065
This comment was minimized by the moderator on the site
Report
0
0
#22066
This comment was minimized by the moderator on the site
Report
1
0
#22068
This comment was minimized by the moderator on the site
Report
0
0
#22067
This comment was minimized by the moderator on the site
Report
0
0
There are no comments posted here yet