Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA - Capturing a checkbox caption into a worksheet.

Hi
This is what I am trying to do. I have about 170 checkboxes on
worksheet. What I want to happen is when I select certain checkboxes
then click a command button, it will pull the caption off eac
selected checkbox and will populate it into another worksheet in colum
A starting on line 3 in a list format.

Can anyone think of a way this can be done?

Any help would be greatly appreciated because I am at a loss and I a
reaching a deadline.

thanks
rot

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Excel VBA - Capturing a checkbox caption into a worksheet.

There are 2 different types of checkboxes that you can have on a worksheet--one
is from the Forms toolbar and the other is from the Control toolbox toolbar:

Option Explicit
Sub testme()

Dim CBX As CheckBox 'from the Forms toolbar
Dim oRow As Long

oRow = 2
For Each CBX In Worksheets("sheet1").CheckBoxes
If CBX.Value = xlOn Then
oRow = oRow + 1
Worksheets("sheet2").Cells(oRow, "A").Value _
= CBX.Caption
End If
Next CBX
End Sub


Sub testme2()

Dim OLEObj As OLEObject
Dim oRow As Long

oRow = 2
For Each OLEObj In Worksheets("Sheet1").OLEObjects
If TypeOf OLEObj.Object Is msforms.CheckBox Then
If OLEObj.Object.Value = True Then
oRow = oRow + 1
Worksheets("sheet2").Cells(oRow, "A").Value _
= OLEObj.Object.Caption
End If
End If
Next OLEObj
End Sub


"rott <" wrote:

Hi
This is what I am trying to do. I have about 170 checkboxes on a
worksheet. What I want to happen is when I select certain checkboxes,
then click a command button, it will pull the caption off each
selected checkbox and will populate it into another worksheet in column
A starting on line 3 in a list format.

Can anyone think of a way this can be done?

Any help would be greatly appreciated because I am at a loss and I am
reaching a deadline.

thanks
rott

---
Message posted from http://www.ExcelForum.com/


--

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
How to insert a CheckBox in a Excel 2007 worksheet?? Inquiringmind Excel Worksheet Functions 0 February 8th 07 08:35 AM
checkbox and worksheet Jenn Excel Discussion (Misc queries) 2 June 26th 06 04:38 PM
CheckBox value to worksheet Patrick Simonds Excel Programming 2 June 14th 04 05:54 PM
Capturing Checkbox Events Mark D'Agosta Excel Programming 8 October 13th 03 01:29 AM
accessing CheckBox on Worksheet Mike Tomasura Excel Programming 4 July 24th 03 01:19 PM


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