Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Ron, thanks for joining our forum (The Code Cage), was your email address right as the confirmation email has been returned? Log on to the forum and send me a private message. -- 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Returning a cell address in a msgbox, by selection via inputbox Ty | Excel Discussion (Misc queries) | |||
Copy Selection - Paste Selection - Delete Selection | Excel Programming | |||
Copy Selection - Transpose Selection - Delete Selection | Excel Discussion (Misc queries) | |||
Why my selection is lost with MsgBox? | Excel Programming | |||
how change selection when msgbox dialog box on screen? | Excel Programming |