Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default 'Autofill' macro for range of checkbox cell links

Hi, I have a list of 1,000 check boxes that all need their cell links
linking to the cell underneath them.

I've done my research and found that there's no way to manually
autofill them, but that there is a macro to do the job
(http://groups.google.com/group/micro...ca2cab5338566f)

Problem is, I don't have the faintest about how to use a macro.

If anybody would like to give me a quick idiot's guide to this, it will
same me a rather repetitive night of adjusting cell links...!!

Thanks!
Nick

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 'Autofill' macro for range of checkbox cell links

First, that routine actually adds new checkboxes from the Forms toolbar to a
sheet--it doesn't modify any existing checkbox properties.

If your checkboxes are from the Forms toolbar, you can use this macro instead:

Option Explicit
Sub FormsCBX()

Dim myCBX As CheckBox
Dim wks As Worksheet

Set wks = ActiveSheet

For Each myCBX In ActiveSheet.CheckBoxes
With myCBX
.LinkedCell = .TopLeftCell.Address(external:=True)
.TopLeftCell.NumberFormat = ";;;"
End With
Next myCBX

End Sub

If your checkboxes are from the Control toolbox toolbar, you can use this macro
instead:

Option Explicit
Sub CtrlCBX()

Dim OLEObj As OLEObject
Dim wks As Worksheet

Set wks = ActiveSheet

For Each OLEObj In ActiveSheet.OLEObjects
If TypeOf OLEObj.Object Is MSForms.CheckBox Then
With OLEObj
.LinkedCell = .TopLeftCell.Address(external:=True)
.TopLeftCell.NumberFormat = ";;;"
End With
End If
Next OLEObj

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

=======

Short course:
Hit alt-f11 to get to the VBE (where macros/UDF's live)
hit ctrl-R to view the project explorer
Find your workbook.
should look like: VBAProject (yourfilename.xls)

right click on the project name
Insert, then Module
You should see the code window pop up on the right hand side

Paste the code in there.

Now go back to excel to test it out.

Tools|Macro|macros|select that macro and click Run

Save your workbook before you run the macro--then if you have trouble, you can
close without saving and bring things back the way they were.

wrote:

Hi, I have a list of 1,000 check boxes that all need their cell links
linking to the cell underneath them.

I've done my research and found that there's no way to manually
autofill them, but that there is a macro to do the job
(
http://groups.google.com/group/micro...ca2cab5338566f)

Problem is, I don't have the faintest about how to use a macro.

If anybody would like to give me a quick idiot's guide to this, it will
same me a rather repetitive night of adjusting cell links...!!

Thanks!
Nick


--

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
Cell References [email protected] Excel Discussion (Misc queries) 2 November 15th 06 11:37 PM
Conditional Format as a MACRO Gunjani Excel Worksheet Functions 3 March 29th 06 05:22 PM
Urgent date/scheduling calc needed jct Excel Worksheet Functions 3 February 24th 06 01:36 AM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
macro help thephoenix12 Excel Discussion (Misc queries) 4 July 15th 05 05:57 PM


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