|
>ユーザーフォーム(Userform1)のモジュールに、
>'=============================================================
>Private Sub UserForm_Initialize()
> With Worksheets("sheet1")
> If chk_autofilter(Worksheets("sheet1")) = True Then
> Selection.AutoFilter
> End If
> Set rng = .Range(.Cells(2, 1), .Cells(.Rows.Count, 1).End(xlUp))
> End With
> If rng.Row > 1 Then
> Application.EnableEvents = False
> Worksheets("sheet1").Range("z1").Formula = "=subtotal(3," & rng.Address & ")"
>' セルz1に、ワークシート関数を入れておきました。セルの位置はとこでも
>' いいです
> rng.Offset(-1, 0).Resize(rng.Count + 1, 3).AutoFilter
ListBox1.ColumnCount = 3
' ↑に変更してください
> ListBox1.List = rng.Resize(, 3).Value
> Application.EnableEvents = True
> End If
>End Sub
|
|