LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Delete an OLE Check Box in COde when a deleting a row

Functionality: To Remove an OLE check box in the row when the user deletes a
row.
This is my current attempt. I get an error message "Can't enter break mode
at this time".
The CheckBox is not linked, it is for visual and print only. There are
remmed statements from previous attempts. Any ideas on this one?

'** Snipped ******************
Dim rowcount As Long
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo Err_Worksheet_Change

Dim llCanDeleteTheBox As Boolean
Dim lcCheckBoxToDelete As String
'Application.EnableEvents = False 'should be part of Change macro

If IsEmpty(rowcount) Then
'* First time through ... *'
Else

If ActiveSheet.UsedRange.Rows.Count = rowcount - 1 Then
'* A row was deleted *'

lcCheckBoxToDelete = "CheckBox" + Trim(Str(ActiveSheet.Range("A"
+ Trim(Str(Target.Row))).Value))

For Each Obj In ThisWorkbook.ActiveSheet.OLEObjects
'* Find the Relative Checkbox *'
Stop
If Obj.Name = lcCheckBoxToDelete Then
Stop
'Obj.Delete
llCanDeleteTheBox = True
'lcCheckBoxToDelete = Obj.Name
'ThisWorkbook.ActiveSheet.OLEObjects(Obj.Name).Del ete
Exit For
End If
Next
End If
End If

If llCanDeleteTheBox Then
Stop
'* Delete the Check Box *'
ThisWorkbook.ActiveSheet.OLEObjects(lcCheckBoxToDe lete).Delete
End If

rowcount = ActiveSheet.UsedRange.Rows.Count
'** End of SNIPPED *****************

--
B Good Lad
 
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
Deleting Check Boxes Within a Range [email protected] Excel Programming 3 November 20th 07 07:03 PM
deleting check control box Brad Excel Discussion (Misc queries) 1 September 29th 05 08:21 PM
Deleting check boxes Tempy Excel Programming 1 May 20th 04 02:28 AM
Deleting check boxes Tempy Excel Programming 5 May 19th 04 04:13 PM
Check if Userform exsists before deleting via VB Rich[_15_] Excel Programming 1 September 19th 03 05:10 AM


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