Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I put this in the general Excel section, but I think it should probably go
here instead. I am updating a very old spreadsheet that I've put 55 check boxes on with the intent that when they are checked and a command button clicked only the pages selected will print. These pages are already set up on the next sheet (it used to be 55 separate sheets, but I've combined these into one), and the page breaks have been set so each will print correctly. I've also put a check box that I've labeled "select all" and print command button so we only print what's needed. Silly me, I thought I could figure this out, but the only thing I can come up with that works is to write 55 separate macros, changing the check boxes to command buttons, and another macro that simply clicked each button. This seems to be very inefficient, and I was hoping someone could help me with this. I would very much appreciate it. -- Message posted via http://www.officekb.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
First I would remove the check boxes and put this code in the sheet module.
Each time you select a cell in column A it will either enter an X or remove the X. (change 1 to any number to change the column A=1, B=2, C=3.....) (This also allows you to make the list shorter or longer without adding code.) Place the second code in a standard module. It will search column A for an X and do whatever you want... ================================= Private Sub Worksheet_SelectionChange(ByVal Target As Range) Application.ScreenUpdating = False Application.EnableEvents = False If Target.Column = 1 And Len(Target) = 0 Then Target = "X" Else Target.ClearContents End If Application.ScreenUpdating = True Application.EnableEvents = True End Sub =================================== Sub DoMyThing() Dim x As Long, lrw As Long Application.ScreenUpdating = False Application.EnableEvents = False lrw = Cells(Rows.Count, "A").End(xlUp).Row For x = 1 To lrw If Len(Cells(x, 1)) 0 Then ' [put your code here] End If Next Application.ScreenUpdating = True Application.EnableEvents = True End Sub ================================= -- steveB Remove "AYN" from email to respond "Frank Rudd via OfficeKB.com" wrote in message ... I put this in the general Excel section, but I think it should probably go here instead. I am updating a very old spreadsheet that I've put 55 check boxes on with the intent that when they are checked and a command button clicked only the pages selected will print. These pages are already set up on the next sheet (it used to be 55 separate sheets, but I've combined these into one), and the page breaks have been set so each will print correctly. I've also put a check box that I've labeled "select all" and print command button so we only what's needed. Silly me, I thought I could figure this out, but the only thing I can come up with that works is to write 55 separate macros, changing the check boxes to command buttons, and another macro that simply clicked each button. This seems to be very inefficient, and I was hoping someone could help me with this. I would very much appreciate it. -- Message posted via http://www.officekb.com |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I've tried this, and apparently I'm doing something wrong. If I were to put
this is column B I understand that the Target.Column = 2. What does "Len" mean? When I try to debug the error, this is the line it stops on. -- Message posted via http://www.officekb.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Checkbox Question | Excel Discussion (Misc queries) | |||
Checkbox Question | Excel Discussion (Misc queries) | |||
Checkbox question | Excel Discussion (Misc queries) | |||
Simple Checkbox Question | Excel Programming | |||
CheckBox question | Excel Programming |