[過去ログ]
Excel VBA 質問スレ Part80 (1002レス)
Excel VBA 質問スレ Part80 http://mevius.5ch.net/test/read.cgi/tech/1685489018/
上
下
前次
1-
新
通常表示
512バイト分割
レス栞
抽出解除
レス栞
このスレッドは過去ログ倉庫に格納されています。
次スレ検索
歴削→次スレ
栞削→次スレ
過去ログメニュー
350: デフォルトの名無しさん [sage] 2024/01/11(木) 21:32:22.23 ID:jLVdVVn1 >>348 そんなことするなら素直に >セルごとに隣接判定をして罫線を描く/描かないの処理 を実装すればいいんじゃねえかと Sub test() Dim r As Range Dim r2 As Range Set r2 = Selection For Each r In Selection If Not isSelect(r, xlEdgeTop) Then r.Borders(xlEdgeTop).LineStyle = xlContinuous If Not isSelect(r, xlEdgeBottom) Then r.Borders(xlEdgeBottom).LineStyle = xlContinuous If Not isSelect(r, xlEdgeLeft) Then r.Borders(xlEdgeLeft).LineStyle = xlContinuous If Not isSelect(r, xlEdgeRight) Then r.Borders(xlEdgeRight).LineStyle = xlContinuous Next End Sub Function isSelect(testRange As Range, index As XlBordersIndex) As Boolean On Error Resume Next Dim r As Range For Each r In Selection Select Case index Case xlEdgeTop If r.Address = testRange.Offset(-1, 0).Address Then isSelect = True Case xlEdgeBottom If r.Address = testRange.Offset(1, 0).Address Then isSelect = True Case xlEdgeLeft If r.Address = testRange.Offset(0, -1).Address Then isSelect = True Case xlEdgeRight If r.Address = testRange.Offset(0, 1).Address Then isSelect = True End Select Next End Function こんな感じか。行数制限あるからやってるけど、1行If は推奨しないぞ http://mevius.5ch.net/test/read.cgi/tech/1685489018/350
352: デフォルトの名無しさん [sage] 2024/01/12(金) 11:23:51.46 ID:Dgb3NVJl >>350 さすがです http://mevius.5ch.net/test/read.cgi/tech/1685489018/352
メモ帳
(0/65535文字)
上
下
前次
1-
新
書
関
写
板
覧
索
設
栞
歴
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.035s