|
りんさん、早速の回答ありがとうございます。
組み合わせると、以下のようになったのですが、修正すべき箇所、改善すべき箇所がございましたら、
アドバイスお願いします。
=========================================================
Sub men()
Dim myGen As String
Dim myRow As Integer
Dim rowEnd As Integer
Dim targetGen As String
Dim fCell As Range
Dim fstAdr As String
rowEnd = CInt(ActiveSheet.Range("A65536").End(xlUp).Row)
'女性か男性かを指定
targetGen = "女性"
Rows("A:IV").Hidden = False
Columns("1:65536").Hidden = False
For myRow = 1 To rowEnd
myGen = Range("C" & myRow).Value
If myGen = targetGen Then
Rows(myRow).Hidden = True
End If
Next myRow
Set fCell = Rows(1).Find(what:="女性")
If Not fCell Is Nothing Then
fstAdr = fCell.Address
Do
fCell.MergeArea.EntireColumn.Hidden = True
Set fCell = Rows(1).Find(after:=fCell)
Loop Until fCell.Address = fstAdr
End If
End Sub
=========================================================
|
|