マクロ

【VBA】×ボタンでフォームが閉じるのを阻止する

Formが閉じる際にQueryCloseが流れるので、そこで阻止すればよい Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = 0 Then MsgBox "[×]ボタンで閉じることはできません。" ’Trueにすることで閉じるのを阻止 Cancel…

【VBA】選択したセルにテキストを配置するマクロ

'選択したセルにテキストを配置Sub insText() Dim Bar As Shape Dim cell As String 'アクティブセルを取得 cell = ActiveCell.address If cell <> "" Then Set Bar = ActiveSheet.Shapes.AddShape _ (msoShapeRectangle, _ Range(cell).Left, _ Range(cell)…

【VBA】選択したセルに赤枠を配置するマクロ

何かと便利かなと '選択したセルに赤枠を配置Sub redFlame() Dim Bar As Shape Dim cell As String 'アクティブセルを取得 cell = ActiveCell.address If cell <> "" Then '図形の種類、位置情報設定 Set Bar = ActiveSheet.Shapes.AddShape _ (msoShapeRect…

【VBA】選択したセルに吹き出しを配置するマクロ

'選択したセルに吹き出しを挿入Sub insBalloon() Dim Bar As Shape Dim cell As String 'アクティブセルを取得 cell = ActiveCell.address If cell <> "" Then Set Bar = ActiveSheet.Shapes.AddShape _ (msoShapeRoundedRectangularCallout, _ Range(cell).…