LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Dave Peterson
 
Posts: n/a
Default

I'm guessing that the reason you got 3 comboboxes to clear was that you used
linked cells in the B2:B5 range.

And when you cleared those cells, you cleared the combobox.

One quick and dirty solution would be to just clear that additional linked cell.

This portion:

Range("B2:B5").Select
Range("B5").Activate
Selection.ClearContents

could be replaced with:
range("b2:B5").clearcontents
(and B5 isn't actually selected!)

Just change that range to include the other linked cell in that statement:

range("b2:B6").clearcontents
or
range("b2:B5,d999").clearcontents

ps. I didn't get an error with Jim's code. But if I had a linked cell, it
didn't get cleared.

But this cleared the combobox and the linked cell:

Option Explicit
Sub testme02A()
Dim OLEObj As OLEObject
For Each OLEObj In ActiveSheet.OLEObjects
If TypeOf OLEObj.Object Is MSForms.CheckBox Then
OLEObj.Object.Value = False
ElseIf TypeOf OLEObj.Object Is MSForms.ComboBox Then
OLEObj.Object.Value = ""
End If
Next OLEObj
End Sub



ynissel wrote:

My macro (that someone from here helped me with a while ago) works great.
But I added a combobox and that one doesnt clear when I execute the macro.
Combo 1,2,3, clear but the 4th doesnt ?
Any ideas ?
Here is my macro.
Thanks,
Yosef

Option Explicit
Sub testme01()

Dim OLEObj As OLEObject
For Each OLEObj In ActiveSheet.OLEObjects
If TypeOf OLEObj.Object Is MSForms.CheckBox Then
OLEObj.Object.Value = False
End If
Next OLEObj
Range("B2:B5").Select
Range("B5").Activate
Selection.ClearContents
End Sub


--

Dave Peterson
 
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
Macros to delete check boxes GWB Direct Excel Discussion (Misc queries) 23 June 3rd 05 09:56 PM
link data to new workbook WYN Excel Discussion (Misc queries) 3 February 28th 05 06:19 AM


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