Posted to microsoft.public.excel.programming
|
|
If Selection < 0 then msgbox
On Apr 27, 11:16*pm, Simon Lloyd
wrote:
Ron i think you may need this:
Dim SumRng as long
Range(Selection, Selection.End(xlDown)).Offset(0, 11).Select
With Selection
SumRng= Application.WorksheetFunction.Sum(Selection)
if SumRng < 0 Then
MsgBox "Out of Balance, range value is " & SumRng
End If
End With
Ron;324548 Wrote:
On Apr 27, 1:42*pm, "Otto Moehrbach"
wrote:
Something like this maybe:
MsgBox "Out of balance. *Value is " & ActiveCell.Value & "."
HTH *Otto"Ron" wrote in message
....
On Apr 27, 12:08 pm, Simon Lloyd
wrote:
Your just missing how to use a worksheet function in VBA:
Range(Selection, Selection.End(xlDown)).Offset(0,
11).Select
With Selection
If Application.WorksheetFunction.Sum(Selection) < 0 Then
MsgBox "Out of Balance"
End If
End With
Ron;324186 Wrote:
Hello all,
I'm trying to validate that the total of the selected cell is <
0
but, I'm getting an error with the code below..
Range(Selection, Selection.End(xlDown)).Offset(0, 11).Select
With Selection
If Sum.Selection < 0 Then
MsgBox "Out of Balance"
End If
End With
Assistance greatly appreciated, Ron
--
Simon Lloyd
Regards,
Simon Lloyd
'The Code Cage' ('The Code Cage' (http://www.thecodecage.com))
------------------------------------------------------------------------
Simon Lloyd's
Profile:'The Code Cage Forums - View Profile: Simon Lloyd'
(http://www.thecodecage.com/forumz/member.php?userid=1)
View this thread:'If Selection < 0 then msgbox - The Code Cage
Forums' (http://www.thecodecage.com/forumz/sh...ad.php?t=90593)
Is there a way to include the difference in the MsgBox?- Hide quoted
text-
- Show quoted text -
Hi Otto, since I'm working with a selection of cells could I edit
your solution? If I edit your solution to MsgBox "Out of balance.
Value is " & Selection.Value & "." will this work? Thank you, Ron
--
Simon Lloyd
Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile:http://www.thecodecage.com/forumz/member.php?userid=1
View this thread:http://www.thecodecage.com/forumz/sh...d.php?t=90593- Hide quoted text -
- Show quoted text -
Simon, thanks. Exactly what I needed for this situation. Thank you
for your assistance, Ron
|