Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Check Box and range selection

I have a list of several hundred items that users can choose. After all
items have been selected, would like to be able to copy those selected items
to a second worksheet for sorting.

All of my checkboxes will be in column A, and the associated item data will
be in the same row as the individual check box (about three or four columns
worth).

Rather than build and code hundreds of check boxes with individual code, can
I create a procedure that will copy only the appropriate ranges when the
user clicks a button (selection complete)?

Thanks in advance...


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Check Box and range selection

What kind of check boxes. From the control toolbox toolbar or from the
forms toolbar?

You want the copy to happen as each checkbox is checked rather than process
the sheet all at one time.

What happens if the user checks the box, then changes their mind and
unchecks it (the data has already been copied if it is copied on checking
the box).

--
Regards,
Tom Ogilvy

"Bob Wall" wrote in message
...
I have a list of several hundred items that users can choose. After all
items have been selected, would like to be able to copy those selected

items
to a second worksheet for sorting.

All of my checkboxes will be in column A, and the associated item data

will
be in the same row as the individual check box (about three or four

columns
worth).

Rather than build and code hundreds of check boxes with individual code,

can
I create a procedure that will copy only the appropriate ranges when the
user clicks a button (selection complete)?

Thanks in advance...




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Check Box and range selection

Bob,
Put a command button on the worksheet. Double click on it and it should
take you to the sheet module for that worksheet. (if not, right click on
the sheet tab and select view code. In the left dropdown at the top of the
module, select commandbutton1 (use the actual name) and from the right
dropdown select click).

Private Sub Commandbutton1_Click()
Dim obj As OLEObject
Dim rng As Range
Dim rng1 As Range
For Each obj In Me.OLEObjects
If TypeOf obj.Object Is MSForms.CheckBox Then
Set rng = obj.TopLeftCell
If rng.Column = 1 Then 'Column A, change to reflect location
' of the checkboxes
If obj.Object.Value = True Then
If rng1 Is Nothing Then
Set rng1 = rng
Else
Set rng1 = Union(rng1, rng)
End If
End If
End If
End If
Next
If Not rng1 Is Nothing Then
rng1.EntireRow.Copy _
Destination:=Worksheets("Sheet2").Range("A2")
End If
End Sub

That worked for me.

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
What kind of check boxes. From the control toolbox toolbar or from the
forms toolbar?

You want the copy to happen as each checkbox is checked rather than

process
the sheet all at one time.

What happens if the user checks the box, then changes their mind and
unchecks it (the data has already been copied if it is copied on checking
the box).

--
Regards,
Tom Ogilvy

"Bob Wall" wrote in message
...
I have a list of several hundred items that users can choose. After all
items have been selected, would like to be able to copy those selected

items
to a second worksheet for sorting.

All of my checkboxes will be in column A, and the associated item data

will
be in the same row as the individual check box (about three or four

columns
worth).

Rather than build and code hundreds of check boxes with individual code,

can
I create a procedure that will copy only the appropriate ranges when the
user clicks a button (selection complete)?

Thanks in advance...






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
Can't check selection boxes LA Excel Discussion (Misc queries) 2 February 2nd 10 06:46 PM
Narrow Range based on Selection in Another Range David Excel Discussion (Misc queries) 3 July 1st 07 05:12 PM
Identifying a selection of a selection of a range swimfast Excel Worksheet Functions 1 March 1st 07 02:51 AM
Excel VBA - Range(Selection, Selection.End(xlDown)).Name issue. jonH Excel Programming 3 June 7th 04 09:13 PM
Check Selection Chris Gorham[_3_] Excel Programming 4 December 29th 03 03:44 PM


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