LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default delete checkboxs

That will definitely create an issue.


You could do the following when adding a checkbox: in a hidden column , say
column , when you add a checkbox, set the cell on the same row in that column
to the name of the checkbox.

''' Carefull, this will write in column A:
'------------------------------------------------------------
ActiveSheet.CheckBoxes.Add(40, 138 + (ActiveCell.Value * 12.75), 93,
17.25).Select
Selection.Characters.Text = "Add to Estimate"
selection.name = "CheckboxRow" & activecell.row ''' <<<<<<<<<
ActiveCell.EntireRow.Cells(1) = "CheckboxRow" & activecell.row ''' <<<<<<<
ActiveCell.Offset(0, 2).Select
'----------------------------------------------------------


Now when deleting the checkbox, use the name in column A of that row instead
of the activecell's row number:
'-----------------------------------------------------------
ActiveSheet.CheckBoxes("CheckboxRow" & activecell.EntireRow.cells(1)).Delete
'-----------------------------------------------------------


One thing you have to do also, is make sure the checkbox 'follows' the row
when resized or new rows are inserted. Set the Placement property of the
checkbox properly when creating it in the above code:
'-----------------------------------------------------------
''' not sure which one of xlMove, xlFreeFloating , xlMoveAndSize
''' try it out
selection.Placement = xlMoveAndSize
'-----------------------------------------------------------


However, there is no way to track a Delete row or an Insert row, so you may
end up with some orphan chekboxes at some point.
To have everything working perfectly, you will need more work. Something to
try is to Protect the sheet and add buttons linked to macros to Insert a row
and Delete a row. This way you know when it happens and you can re-arrange
your checkboxes.


Regards,
Sébastien
<http://www.ondemandanalysis.com
<http://www.ready-reports.com


"ranswert" wrote:

This worked until I deleted a row in the center of my sheet and the checkboxs
below the deleted row kept the same row number and it didn't match the row
that the checkbox was in.
Thanks

 
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
checkboxs Robin Excel Discussion (Misc queries) 12 August 10th 09 01:31 PM
checkboxs. Robin Excel Discussion (Misc queries) 0 June 1st 09 10:11 PM
Excel Checkboxs, Optionbox Brandon Excel Discussion (Misc queries) 1 January 19th 07 08:25 PM
Checkboxs Move in Document Sherry Excel Discussion (Misc queries) 1 November 22nd 05 08:13 PM
using Sub's with checkboxs dave bryden Excel Programming 4 February 26th 04 10:24 PM


All times are GMT +1. The time now is 01:55 AM.

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"