Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default What is wrong with this code?


Sub Macro1()

Sheets("Sheet1").Select
If Range("H20").Select = "FALSE" Then
MsgBox "NOT CHECKED"
Else
MsgBox "CHECKED"
End If

End Sub



H20 contains the result of a checkbox of either a False or True. Seem
im always getting the Checked response which means im obviously no
getting the result form the sheet correctly.

Thanks again,
Ke

--
sungen9
-----------------------------------------------------------------------
sungen99's Profile: http://www.excelforum.com/member.php...nfo&userid=914
View this thread: http://www.excelforum.com/showthread.php?threadid=47551

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default What is wrong with this code?


Yep. That works.

Thanks


--
sungen99
------------------------------------------------------------------------
sungen99's Profile: http://www.excelforum.com/member.php...fo&userid=9144
View this thread: http://www.excelforum.com/showthread...hreadid=475516

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default What is wrong with this code?

or this, no need to select anything:

Sub Macro1()

If Sheets("Sheet1").Range("H20").Text = "FALSE" Then
MsgBox "NOT CHECKED"
Else
MsgBox "CHECKED"
End If

End Sub

--


Gary


"sungen99" wrote in
message ...

Sub Macro1()

Sheets("Sheet1").Select
If Range("H20").Select = "FALSE" Then
MsgBox "NOT CHECKED"
Else
MsgBox "CHECKED"
End If

End Sub



H20 contains the result of a checkbox of either a False or True. Seems
im always getting the Checked response which means im obviously not
getting the result form the sheet correctly.

Thanks again,
Ken


--
sungen99
------------------------------------------------------------------------
sungen99's Profile:
http://www.excelforum.com/member.php...fo&userid=9144
View this thread: http://www.excelforum.com/showthread...hreadid=475516



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default What is wrong with this code?


Even simpler. Since the data source of a checkbox is a boolean value
this will work.

Sub Macro1()

If Sheets("Sheet1").Range("H20") Then
MsgBox "Checked"
Else
MsgBox "Not Checked"
End If

End Sub



*** Sent via Developersdex http://www.developersdex.com ***
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
What is wrong with the code? Eric Excel Discussion (Misc queries) 2 September 13th 07 10:36 AM
What's wrong with this code??? Twain[_3_] Excel Programming 3 August 1st 05 03:02 PM
HELP! What's wrong with my code? Sethaholic[_6_] Excel Programming 0 July 11th 05 07:37 PM
What is wrong with this code? Jan Excel Programming 4 June 14th 05 06:48 PM
What's wrong w/my code? nrage21[_54_] Excel Programming 5 July 28th 04 03:50 PM


All times are GMT +1. The time now is 09:58 PM.

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

About Us

"It's about Microsoft Excel"