「Excel VBA オートフィルタをで行が隠れているか判定」の版間の差分
ナビゲーションに移動
検索に移動
(ページの作成:「====== Cells(r, c).EntireRow.Hidden ===オートフィルタ済みで見えている行のみで上の行と重複があれば"1"を設定する例=== Sub Duplicat…」) |
|||
| 33行目: | 33行目: | ||
r = r + 1 | r = r + 1 | ||
DoEvents | DoEvents | ||
| − | Loop While Trim(s) | + | Loop While Trim(s) <> "" |
MsgBox "終了" | MsgBox "終了" | ||
End Sub | End Sub | ||
2020年2月15日 (土) 08:02時点における版
==
Cells(r, c).EntireRow.Hidden
オートフィルタ済みで見えている行のみで上の行と重複があれば"1"を設定する例
Sub DuplicateRowCheck_Click()
Const START_ROW As Integer = 4
Const TARGET_COL As Integer = 5
Const RESULT_COL As Integer = 6
Dim r As Long
Dim pn As String
Dim s As String
Dim temp As String
Dim pre As String
Dim preRow As Long
r = START_ROW
Do
s = Cells(r, TARGET_COL).Text
If Not Cells(r, TARGET_COL).EntireRow.Hidden Then
temp = s
If pre = temp Then
Cells(preRow, RESULT_COL).Value = "1"
Cells(r, RESULT_COL).Value = "1"
End If
pre = temp
preRow = r
Else
Cells(r, RESULT_COL).Value = ""
End If
r = r + 1
DoEvents
Loop While Trim(s) <> ""
MsgBox "終了"
End Sub
© 2006 矢木浩人