Excelで色を塗りつぶしながらグリッド線を保持するにはどうすればよいですか?
ご存知のとおり、セルに背景色を塗りつぶすと、グリッド線もカバーされます。この場合、Excelセルに背景色を塗りつぶしながらグリッド線を維持して、次のスクリーンショットを表示するにはどうすればよいでしょうか。
VBAコードで色を塗りつぶしながらグリッド線を保持する
通常、この仕事を直接解決する方法はありませんが、ここでは、VBAコードを紹介します。 次のようにしてください。
1。 を押し続けます Alt + F11 キーを押して アプリケーション向け Microsoft Visual Basic 窓。
2。 左側で プロジェクト-VBAProject ペイン、ダブルクリック このワークブック 拡張された下 VBAプロジェクト、次に、次のVBAコードをコピーして空のモジュールに貼り付けます。
VBAコード:色を塗りつぶしながらグリッド線を保持する
Dim xRgPre As Range
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
On Error Resume Next
If Not xRgPre Is Nothing Then DrawBorders xRgPre
Set xRgPre = Target
End Sub
Private Sub DrawBorders(ByVal Rg As Range)
'Updateby Extendoffice 20160725
Dim xCell As Range
Application.ScreenUpdating = False
For Each xCell In Rg
If xCell.Interior.ColorIndex = xlNone Then
With xCell.Borders
If .ColorIndex = 15 Then
.LineStyle = xlNone
End If
End With
Else
With xCell.Borders
If .LineStyle = xlNone Then
.Weight = xlThin
.ColorIndex = 15
End If
End With
End If
Next
Application.ScreenUpdating = True
End Sub
3。 次に、コードウィンドウを保存して閉じます。これで、セルの範囲の色を塗りつぶすと、グリッド線が自動的に表示されます。
最高のオフィス生産性向上ツール
🤖 | 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
#44905
This comment was minimized by the moderator on the site
0
0
#44502
This comment was minimized by the moderator on the site
0
0
#41143
This comment was minimized by the moderator on the site
0
0
#35387
This comment was minimized by the moderator on the site
Report
0
0
#32797
This comment was minimized by the moderator on the site
0
0
#25936
This comment was minimized by the moderator on the site
0
0
#39049
This comment was minimized by the moderator on the site
0
0
#25939
This comment was minimized by the moderator on the site
0
0
#25938
This comment was minimized by the moderator on the site
0
0
#25937
This comment was minimized by the moderator on the site
0
0
#24417
This comment was minimized by the moderator on the site
0
0
#24418
This comment was minimized by the moderator on the site
Report
0
0
#22846
This comment was minimized by the moderator on the site
0
0
#22840
This comment was minimized by the moderator on the site
0
0
#22841
This comment was minimized by the moderator on the site
0
0
#22307
This comment was minimized by the moderator on the site
0
0
#22309
This comment was minimized by the moderator on the site
Report
0
0
#22308
This comment was minimized by the moderator on the site
Report
0
0
There are no comments posted here yet