Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Using Checkboxes to enable/disable vb

I'm running a macro and trying to have parts of the code run or not run
depending on whether various checkboxes are checked.

The checkboxes are from the Forms toolbar, and they all reference cells
in column L

Basically this is what I have..
If Sheet1.Cells(12, 7).Value = "TRUE" Then (I've tried of variations
of referencing the cell)
....code...

and just for good measure in the Else portion I've put
Sheet1.Range("E7") = [L7].Value

And of course L7 reads TRUE when I run the macro.


Thanks in advance

Paul Salama

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using Checkboxes to enable/disable vb


I am not certain if this will help with your problem.

But I created a blank **** and a checkbox and put the following code in
it:

Sub test()
If CheckBox1.Value = "True" Then
MsgBox ("True")
Else
If CheckBox1.Value = "False" Then
MsgBox ("False")
End If
End If
End Sub

It also works if you are referencing a cell's value.


--
Bearacade


------------------------------------------------------------------------
Bearacade's Profile: http://www.excelforum.com/member.php...o&userid=35016
View this thread: http://www.excelforum.com/showthread...hreadid=551920

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Using Checkboxes to enable/disable vb

Thanks a lot. it seems that the capitalization made a difference. so
matching on "True" worked, but not "TRUE"... Even though the actual
text is capitalized.

so this is what worked:
If Sheet1.[L7].Value = "True" Then
....code...

Thanks again.

Paul

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Using Checkboxes to enable/disable vb

Did removing the double quotes work when you tried it?


Paul wrote:

Thanks a lot. it seems that the capitalization made a difference. so
matching on "True" worked, but not "TRUE"... Even though the actual
text is capitalized.

so this is what worked:
If Sheet1.[L7].Value = "True" Then
...code...

Thanks again.

Paul


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Using Checkboxes to enable/disable vb

Oddly enough it didn't

Dave Peterson wrote:
Did removing the double quotes work when you tried it?


Paul wrote:

Thanks a lot. it seems that the capitalization made a difference. so
matching on "True" worked, but not "TRUE"... Even though the actual
text is capitalized.

so this is what worked:
If Sheet1.[L7].Value = "True" Then
...code...

Thanks again.

Paul


--

Dave Peterson


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Using Checkboxes to enable/disable vb

It worked ok for me when I tested.

Paul wrote:

Oddly enough it didn't

Dave Peterson wrote:
Did removing the double quotes work when you tried it?


Paul wrote:

Thanks a lot. it seems that the capitalization made a difference. so
matching on "True" worked, but not "TRUE"... Even though the actual
text is capitalized.

so this is what worked:
If Sheet1.[L7].Value = "True" Then
...code...

Thanks again.

Paul


--

Dave Peterson


--

Dave Peterson
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
Enable/Disable Macro Pop-Up juamig Excel Discussion (Misc queries) 5 April 12th 10 02:57 PM
Enable/Disable Macros Pop-Up juamig Excel Discussion (Misc queries) 1 April 9th 10 06:29 PM
Enable/Disable Macros Ben Schaum Excel Discussion (Misc queries) 1 January 21st 05 03:42 PM
How to enable/disable a button. Polly[_3_] Excel Programming 2 May 28th 04 04:24 AM
Enable/Disable Macros Joseph[_6_] Excel Programming 3 August 23rd 03 02:54 PM


All times are GMT +1. The time now is 03:07 AM.

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"