スクロールバー †
以下は列colに行startRowからendRowまでチェックボックスを作成する例です。 Sub scbrList_Change() Dim sht As Worksheet Dim shp As Shape Dim scbr As ScrollBar Set sht = ActiveSheet Set shp = sht.Shapes("scbrList") Set scbr = shp.OLEFormat.Object '画面の描画をOFFにします。 Application.ScreenUpdating = False If scbr.Value = scbr.Min Then sht.Range(Rows(rowTop), Rows(rowTop + rowOnList - 1)).Hidden = False sht.Range(Rows(rowTop + rowOnList), Rows(rowBtm)).Hidden = True ElseIf scbr.Value = scbr.Max Then sht.Range(Rows(rowTop), Rows(rowTop + scbr.Max - 2)).Hidden = True sht.Range(Rows(rowTop + scbr.Max - 1), Rows(rowBtm)).Hidden = False Else sht.Range(Rows(rowTop), Rows(rowTop + scbr.Value - 2)).Hidden = True sht.Range(Rows(rowTop + scbr.Value - 1), Rows(rowTop + scbr.Value + rowOnList - 2)).Hidden = False sht.Range(Rows(rowTop + scbr.Value + rowOnList - 1), Rows(rowBtm)).Hidden = True End If Cbx_Visible_Set sht, scbr.Value, scbr.Value + rowOnList - 1 '画面の描画をONに戻します。 Application.ScreenUpdating = True End Sub
Sub scbrList_Reset(sht As Worksheet) Dim shp As Shape 'Shape型の変数を宣言する。 Dim scbr As ScrollBar 'ScrollBar型の変数を宣言する。 Set shp = sht.Shapes("scbrList") Set scbr = shp.OLEFormat.Object scbr.Value = 1 Set shp = Nothing Set scbr = Nothing End Sub Last-modified: 2014-03-11 (火) 01:58:42 (3859d)
|