Range("A1:C3").Dirty
でもユーザー定義関数(Function)からの呼び出しでは機能しない。
サブルーチン(sub)経由で呼べば使える
Range("A1:C3").Dirty
でもユーザー定義関数(Function)からの呼び出しでは機能しない。
サブルーチン(sub)経由で呼べば使える
Dim a_cell As Variant Private Sub Worksheet_Calculate() If a_cell = "" Then a_cell = Cells(1,1).Value 'セルに初期値が入っていない時に代入 Exit Sub '1回目だけは、そのまま抜ける End If If a_cell <> Cells(1, 1).Value Then 'セル値が変化した時のみ動作 Cells(1, 1).Interior.Pattern = xlNone 'セル色なし Application.Wait(Now + TimeValue("0:00:01")) '1秒待つ Cells(1, 1).Interior.Color = RGB(256, 0, 0) 'セル色赤 Application.Wait(Now + TimeValue("0:00:01")) '1秒待つ Cells(1, 1).Interior.Pattern = xlNone 'セル色なし Application.Wait(Now + TimeValue("0:00:01")) '1秒待つ Cells(1, 1).Interior.Color = RGB(256, 0, 0) 'セル色赤 Application.Wait(Now + TimeValue("0:00:01")) '1秒待つ Cells(1, 1).Interior.Pattern = xlNone 'セル色なし a_cell = Cells(1,1).Value 'セル値を更新 End If End Sub
規定のコードを埋め込んでおくと、Googleにてリッチな検証結果として表示してくれるらしい
必要なコードはこのツールで作れる
確認はこちらで
Dim bOPen_UserForm1 As Boolean: bOPen_UserForm1 = False Dim f As UserForm For Each f In UserForms If TypeOf f Is UserForm1 Then bOPen_UserForm1 = True 'MsgBox "開かれている" End If Next If bOPen_UserForm1 = False Then Exit Sub End If 'ダイアログが見えてるか調査 If UserForm1.Visible = False Then Exit Sub End If
簡単な関数があるわけじゃない
シンプルなのは、指定文字を削除した文字列をつくって、
その文字列と元の文字列の文字数の差分取る方法
A1列のデータ最終行の例
Cells(Rows.Count, Range(”A1").Row).End(xlUp).Row
マニフェストファイルappsscript.jsonに以下で許可登録
"oauthScopes": ["https://www.googleapis.com/auth/script.external_request","https://www.googleapis.com/auth/spreadsheets.currentonly","https://www.googleapis.com/auth/documents"],
以下コード(テキストメール)
SEND_GRID_ENDPOINT = "https://api.sendgrid.com/v3/mail/send"; SEND_GRID_API_KEY = "あなたのAPIキー"; function sendEmailBySendGrid(to,subject,from,from_name,bcc,body_text){ var body = { "personalizations": [ { "to": [ { "email": to } ], "bcc":[ { "email": bcc } ], "subject": subject } ], "from": { "email": from, "name" : from_name }, "content": [ { "type": "text", // htmlメールにしたいなら"text/html" "value": body_text } ] } var payload = JSON.stringify(body); UrlFetchApp.fetch(SEND_GRID_ENDPOINT, { method: 'POST', headers: { "Content-Type": 'application/json', "Authorization": "Bearer "+SEND_GRID_API_KEY}, payload: payload }); }
Dim fso As FileSystemObject Set fso = New FileSystemObject Dim ts As TextStream Set ts = fso.OpenTextFile("D:\Tips.txt", ForAppending, True, TristateTrue) ' ファイルを UTF-16 で開く Set ts = fso.OpenTextFile("D:\Tips.txt", ForAppending, True, TristateFalse) ' ファイルを Shift_JIS で開く ts.WriteLine ("追記") ' 書き込み ts.Close ' ファイルを閉じる ' 後始末 Set ts = Nothing Set fso = Nothing