Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default If Selection < 0 then msgbox

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default If Selection < 0 then msgbox


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' (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...ad.php?t=90593

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default If Selection < 0 then msgbox

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' (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...ad.php?t=90593


Hi Simon,
Thanks, this will come in handy in other projects. Thank you, Ron
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default If Selection < 0 then msgbox

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' (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...ad.php?t=90593


Is there a way to include the difference in the MsgBox?
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default If Selection < 0 then msgbox

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' (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...ad.php?t=90593


Is there a way to include the difference in the MsgBox?




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default If Selection < 0 then msgbox

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' (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...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
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default If Selection < 0 then msgbox


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...ad.php?t=90593

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Returning a cell address in a msgbox, by selection via inputbox Ty FARAZ QURESHI Excel Discussion (Misc queries) 3 April 8th 09 12:57 PM
Copy Selection - Paste Selection - Delete Selection Uninvisible Excel Programming 2 October 25th 07 01:31 PM
Copy Selection - Transpose Selection - Delete Selection Uninvisible Excel Discussion (Misc queries) 2 October 23rd 07 04:18 PM
Why my selection is lost with MsgBox? MLevesque Excel Programming 6 August 9th 05 05:10 AM
how change selection when msgbox dialog box on screen? Ian Elliott[_2_] Excel Programming 1 September 9th 03 01:47 PM


All times are GMT +1. The time now is 10:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"