Last active
June 25, 2022 05:49
-
-
Save KotorinChunChun/7f7bd7e8e5a967f40f4e68902693fd0a to your computer and use it in GitHub Desktop.
個人用マクロブックのPERSONAL.XLSBのThisWorkbookモジュールに書くだけで勝手にA1にカーソルが配置されるVBA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rem 個人用マクロブックのPERSONAL.XLSBのThisWorkbookモジュールに書くだけで、 | |
Rem 勝手にA1にカーソルが配置されるVBA | |
Option Explicit | |
Private WithEvents app As Excel.Application | |
Private Sub Workbook_Open() | |
Set app = Excel.Application | |
End Sub | |
Private Sub app_WorkbookOpen(ByVal Wb As Workbook) | |
If Wb.IsAddin Then Exit Sub | |
If Wb Is Me Then Exit Sub | |
If Wb.Windows(1).Visible = False Then Exit Sub | |
Dim defWs As Worksheet | |
Set defWs = Wb.ActiveSheet | |
Dim ws As Worksheet | |
For Each ws In Wb.Worksheets | |
If ws.Visible = xlSheetVisible Then | |
ws.Parent.Activate | |
ws.Select | |
ws.Range("A1").Select | |
Wb.Windows(1).ScrollRow = 1 | |
Wb.Windows(1).ScrollColumn = 1 | |
Wb.Windows(1).Zoom = 100 | |
End If | |
Next | |
defWs.Activate | |
End Sub |
分かってると思うけど、いつものネタマクロだからね
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
マナーにうるさい人のパソコンにコッソリ仕込むのがオススメです。
PERSONAL.XLSBの作り方は↓記事参照
https://excel-chunchun.com/entry/20211230-excel-personal-addin