advanced help
per page, with , order by , clip by
Results of 1 - 1 of about 28 for 平均 平日 (0.001 sec.)
平均 (1363), 平日 (459)
[[20110708211408]]
#score: 10347
@digest: 13b4869d4063f5c3945adf23dd6a8ae2
@id: 55177
@mdate: 2011-07-09T04:35:50Z
@size: 2551
@type: text/plain
#keywords: flag (3834), xlcelltypeformulas (2773), saveasui (1829), 囲内 (1558), beforesave (1458), 警告 (1190), boolean (1103), isnumeric (1079), た" (998), て0 (822), 変参 (793), 式) (741), specialcells (693), nothing (645), が0 (627), vbyesno (611), vblf (521), に式 (496), 適切 (449), ッセ (440), メッ (438), else (425), address (422), チェ (417), msgbox (408), 保存 (396), セー (389), 算結 (386), ェッ (378), cancel (377), then (358), 範囲 (286)
『VBAを用いてすべてのシートの特定のセル(複数)の計算結果が0以外であれば警告が出るようにしたい』(てん)
こんにちは。 ある数値を入力してそれがある値と比較して誤差をチェックする(K27-L27みたいな簡単な式)際に、 その値が0出ない場合に警告がでるようにしたいです。 式が入っているのは列になっていて、さらに複数あります。 色々やってみたんですがだめでした。 WindowsXP、Excel2007を使用しています。 よろしくお願いします。 ---- たとえばE列の式をチェック。 Sub Sample() Dim c As Range Dim r As Range Dim s As String Dim flag As Boolean Set r = Columns("E").SpecialCells(xlCellTypeFormulas, 23) If Not r Is Nothing Then For Each c In r flag = False If IsNumeric(c.Value) Then If c.Value <> 0 Then flag = True Else flag = True End If If flag Then s = s & c.Address(0, 0) & " " Next If Len(s) = 0 Then MsgBox "範囲内の式の結果はすべて0でした" Else MsgBox "以下のセルの値が0ではありませんでした" & vbLf & s End If Else MsgBox "範囲内に式はありません" End If Set r = Nothing End Sub ぶらっと立ち寄り ---- すみません補足です。 チェックしたいセルはO4,O6〜O25で、エクセルを保存する際にメッセージが出るようにしたいです。 たびたび済みませんがよろしくおねがいします。 上の式は大変参考になりました。ありがとうございました。 ---- それでは、保存する前にメッセージを。 ThisWorkbookモジュールに以下。シート名は適切なものに。 Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim c As Range Dim r As Range Dim s As String Dim flag As Boolean On Error Resume Next Set r = Sheets("Sheet1").Range("O4,O6:O25").SpecialCells(xlCellTypeFormulas, 23) On Error GoTo 0 If Not r Is Nothing Then For Each c In r flag = False If IsNumeric(c.Value) Then If c.Value <> 0 Then flag = True Else flag = True End If If flag Then s = s & c.Address(0, 0) & " " Next If Len(s) = 0 Then s = "範囲内の式の結果はすべて0でした" Else s = "以下のセルの値が0ではありませんでした" & vbLf & s End If Else s = "範囲内に式はありません" End If If MsgBox(s & vbLf & "保存しますか?", vbYesNo) = vbNo Then Cancel = True Set r = Nothing End Sub ぶらっと立ち寄り ...
http://www.excel.studio-kazu.jp/wiki/kazuwiki/201107/20110708211408.txt - [detail] - similar
PREV NEXT
Powered by Hyper Estraier 1.4.13, with 96991 documents and 607811 words.

訪問者:カウンタValid HTML 4.01 Transitional