Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default CheckBox question

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default CheckBox question

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
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default CheckBox question

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
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
Checkbox Question slow386 Excel Discussion (Misc queries) 7 July 21st 07 12:06 AM
Checkbox Question MCrum Excel Discussion (Misc queries) 1 January 15th 07 12:38 PM
Checkbox question Adam Kroger Excel Discussion (Misc queries) 0 December 19th 05 12:41 PM
Simple Checkbox Question Tom Ogilvy Excel Programming 3 February 3rd 05 09:04 PM
CheckBox question Sheldon Excel Programming 6 January 25th 05 05:11 PM


All times are GMT +1. The time now is 10:15 PM.

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

About Us

"It's about Microsoft Excel"