Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Make a check box run a macro


Hello,
I want a check box run a macro. Basically what I want to do is if the check
box is cheked then some columns become unhide. If the checkbox is not checked
then the columns remain hide. The check box is on the "Main Input" and the
columns hidden or not are on the "Summary" worksheet. This is what I wrote so
far:

Sheets("Summary").Select
Columns("AS:BA").Select
Selection.EntireColumn.Hidden = False
Range("A1").Select
Sheets("Main Input").Select
End Sub

Thanks
Miguel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Make a check box run a macro


hi
try this
Private Sub CheckBox1_Click()
If CheckBox1.Value = ture Then
Sheets("Summary").Columns("AS:BA").EntireColumn.Hi dden = False
Else
Sheets("Summary").Columns("AS:BA").EntireColumn.Hi dden = True
End If
End Sub
i eliminated all the selecting and flopping back and forth from sheet to
sheet.
that is really not needed.

Regards
FSt1

"Miguel" wrote:

Hello,
I want a check box run a macro. Basically what I want to do is if the check
box is cheked then some columns become unhide. If the checkbox is not checked
then the columns remain hide. The check box is on the "Main Input" and the
columns hidden or not are on the "Summary" worksheet. This is what I wrote so
far:

Sheets("Summary").Select
Columns("AS:BA").Select
Selection.EntireColumn.Hidden = False
Range("A1").Select
Sheets("Main Input").Select
End Sub

Thanks
Miguel

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Make a check box run a macro


Hi,
I use the code below, but the code
If CheckBox1.Value = True Then
gets highlighted and there's a error message "object required". What can I
do to fix the problem?

Miguel

"FSt1" wrote:

hi
try this
Private Sub CheckBox1_Click()
If CheckBox1.Value = ture Then
Sheets("Summary").Columns("AS:BA").EntireColumn.Hi dden = False
Else
Sheets("Summary").Columns("AS:BA").EntireColumn.Hi dden = True
End If
End Sub
i eliminated all the selecting and flopping back and forth from sheet to
sheet.
that is really not needed.

Regards
FSt1

"Miguel" wrote:

Hello,
I want a check box run a macro. Basically what I want to do is if the check
box is cheked then some columns become unhide. If the checkbox is not checked
then the columns remain hide. The check box is on the "Main Input" and the
columns hidden or not are on the "Summary" worksheet. This is what I wrote so
far:

Sheets("Summary").Select
Columns("AS:BA").Select
Selection.EntireColumn.Hidden = False
Range("A1").Select
Sheets("Main Input").Select
End Sub

Thanks
Miguel

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Make a check box run a macro


In addition to that,
how can I add this macro to this checkbox?

Thanks

"Miguel" wrote:

Hello,
I want a check box run a macro. Basically what I want to do is if the check
box is cheked then some columns become unhide. If the checkbox is not checked
then the columns remain hide. The check box is on the "Main Input" and the
columns hidden or not are on the "Summary" worksheet. This is what I wrote so
far:

Sheets("Summary").Select
Columns("AS:BA").Select
Selection.EntireColumn.Hidden = False
Range("A1").Select
Sheets("Main Input").Select
End Sub

Thanks
Miguel

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Make a check box run a macro


hi
assumming you are using a active X checkbox from the control tool box...
in design mode, right click the check box and from the popup click view code.
sub checkbox1_click() will default in. past the code into to the sub.
techniqually this is more sheet code in that the check box is assigned to the
sheet. it does not go in a standard module.

regards
FSt1

"Miguel" wrote:

Hi,
I use the code below, but the code
If CheckBox1.Value = True Then
gets highlighted and there's a error message "object required". What can I
do to fix the problem?

Miguel

"FSt1" wrote:

hi
try this
Private Sub CheckBox1_Click()
If CheckBox1.Value = ture Then
Sheets("Summary").Columns("AS:BA").EntireColumn.Hi dden = False
Else
Sheets("Summary").Columns("AS:BA").EntireColumn.Hi dden = True
End If
End Sub
i eliminated all the selecting and flopping back and forth from sheet to
sheet.
that is really not needed.

Regards
FSt1

"Miguel" wrote:

Hello,
I want a check box run a macro. Basically what I want to do is if the check
box is cheked then some columns become unhide. If the checkbox is not checked
then the columns remain hide. The check box is on the "Main Input" and the
columns hidden or not are on the "Summary" worksheet. This is what I wrote so
far:

Sheets("Summary").Select
Columns("AS:BA").Select
Selection.EntireColumn.Hidden = False
Range("A1").Select
Sheets("Main Input").Select
End Sub

Thanks
Miguel



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Make a check box run a macro


hi
if you do have the code in a standard module, VB can't find the
checkbox.(object required) once you put it in the check box code, it should
works. it works for me.

regards
FSt1

"Miguel" wrote:

Hi,
I use the code below, but the code
If CheckBox1.Value = True Then
gets highlighted and there's a error message "object required". What can I
do to fix the problem?

Miguel

"FSt1" wrote:

hi
try this
Private Sub CheckBox1_Click()
If CheckBox1.Value = ture Then
Sheets("Summary").Columns("AS:BA").EntireColumn.Hi dden = False
Else
Sheets("Summary").Columns("AS:BA").EntireColumn.Hi dden = True
End If
End Sub
i eliminated all the selecting and flopping back and forth from sheet to
sheet.
that is really not needed.

Regards
FSt1

"Miguel" wrote:

Hello,
I want a check box run a macro. Basically what I want to do is if the check
box is cheked then some columns become unhide. If the checkbox is not checked
then the columns remain hide. The check box is on the "Main Input" and the
columns hidden or not are on the "Summary" worksheet. This is what I wrote so
far:

Sheets("Summary").Select
Columns("AS:BA").Select
Selection.EntireColumn.Hidden = False
Range("A1").Select
Sheets("Main Input").Select
End Sub

Thanks
Miguel

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Make a check box run a macro


Thanks a lot. It works

"Miguel" wrote:

In addition to that,
how can I add this macro to this checkbox?

Thanks

"Miguel" wrote:

Hello,
I want a check box run a macro. Basically what I want to do is if the check
box is cheked then some columns become unhide. If the checkbox is not checked
then the columns remain hide. The check box is on the "Main Input" and the
columns hidden or not are on the "Summary" worksheet. This is what I wrote so
far:

Sheets("Summary").Select
Columns("AS:BA").Select
Selection.EntireColumn.Hidden = False
Range("A1").Select
Sheets("Main Input").Select
End Sub

Thanks
Miguel

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
make a check form, and then have info go to a check register richie g Excel Worksheet Functions 0 May 5th 10 12:10 AM
How do I make the check mark boc bigger on the check box? srod Excel Discussion (Misc queries) 0 October 6th 08 09:52 PM
how do I make a check box larger? Cheryl Excel Discussion (Misc queries) 2 September 10th 08 01:18 PM
VBA to Make Check Box Entry Ken Hudson Excel Programming 5 June 22nd 07 03:36 PM
Macro to make a cell work like a check Logan[_2_] Excel Programming 2 February 3rd 04 04:11 AM


All times are GMT +1. The time now is 05:10 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"