![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Apr 2002
Location: Alberta, Canada
Posts: 50
|
why is this not working?
Private Sub OK_Click() If CC Then MsgBox ("You have selected Cost Center") If CC_Prime Then MsgBox ("You have selected Prime") Else MsgBox ("You must click either Cost Center or Cost Center and Primes") End [ This Message was edited by: excelmacro on 2002-04-25 08:41 ] [ This Message was edited by: excelmacro on 2002-05-03 12:23 ] |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Sunny, spring-like Hull
Posts: 3,339
|
Try this, you needed to use a block If..Then..Else: -
Private Sub OK_Click() If CC Then MsgBox ("You have selected Cost Center") If CC_Prime Then MsgBox ("You have selected Prime") Else MsgBox ("You must click either Cost Center or Cost Center and Primes") End End If End Sub |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Apr 2002
Location: Alberta, Canada
Posts: 50
|
now when i click on CC and then hit the ok button, it comes up with the msgbox "You have selected Cost Center" response, and then the msgbox "You must click either the Cost Center or Cost Center and Primes". It works fine though when i only check on CC_Prime or don't check either of CC or CC_Prime
|
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
Try,
Private Sub OK_Click() If CC Then MsgBox ("You have selected Cost Center") ElseIf CC_Prime Then MsgBox ("You have selected Prime") Else MsgBox ("You must click either Cost Center or Cost Center and Primes") End If End Sub |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Apr 2002
Location: Alberta, Canada
Posts: 50
|
Thanks. Works great.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|