Skip to content

Instantly share code, notes, and snippets.

@hedgejanuary
Created June 15, 2018 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hedgejanuary/e252dfdde2148a0ebf8eb864721b5ab9 to your computer and use it in GitHub Desktop.
Save hedgejanuary/e252dfdde2148a0ebf8eb864721b5ab9 to your computer and use it in GitHub Desktop.
Set the zoom level 100% & standard view, and select A1 cell.
Sub FinaliseWorksheetsSetting()
'すべてのシートのアクティブセルをA1とし、標準表示・表示倍率を100%に設定する。
'アドインとして登録しているため、ThisWorkbookではなくActiveWorkbookとしている。
Dim i As Long
Dim ZoomLevel As Long
ZoomLevel = InputBox(Prompt:="シートの表示倍率を" & vbCrLf & "半角数字で指定してください。", Default:=100)
If StrPtr(ZoomLevel) = 0 Then Exit Sub
For i = 1 To ActiveWorkbook.Worksheets.Count
ActiveWorkbook.Worksheets(i).Activate
ActiveSheet.Range("A1").Select
ActiveWindow.ScrollColumn = 1
ActiveWindow.ScrollRow = 1
ActiveWindow.View = xlNormalView
ActiveWindow.Zoom = ZoomLevel
Next i
ActiveWorkbook.Worksheets(1).Activate
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment