Hi great forum
I have a simple userform with two controls : commandbutton and refedit
I want to use the refedit control to select some nonadjacent cells and the command button to clear the contents of these cells
Hi great forum
I have a simple userform with two controls : commandbutton and refedit
I want to use the refedit control to select some nonadjacent cells and the command button to clear the contents of these cells
[VBA]Private Sub CommandButton1_Click()
Dim r As Range
Set r = Range(RefEdit1.Value)
r.ClearContents
Unload Me
End Sub[/VBA]
Thank you very much
But it has a debug if I used Ctrl key to select non-adjacent cells
I select A1 and e5 and F7 and I got the error runtime 1004
Works fine for me. Is your worksheetprotected?
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
No, my worksheets isn't protected
Try to select more than two ranges
I did, I selected A1, E5 and E7 as you did.
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
I got the following error
Maybe you selected cells where some were merged?
No merged cells in my sheet at all
I'm sorry for disturbing you
But I'm sure we will find a solution with you
Post your workbook, and let's see if we get a problem with that.
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
OK my dear
This is my workbook
Your example worked fine for me.
I'm using Excel2007 and Windows SP2 .. May be the version of the office or the Windows??
I try to solve it but I can't
Please help me!!
Was it from a 2003 file? Try what was said in http://www.excelforum.com/excel-prog...ding-dll.html:
In Tools -> References and I pointed on the "Missing: Ref Edit Control" and on the bottom of this box "Location:C:\Program Files\Microsoft Office\OFFICE12\REFEDIT.DLL" was. So on the other data I created the "OFFICE12" folder in to "Microsoft Office" and I copyed from my data the "REFEDIT.DLL" in to it. I have both Office (2003, 2007) and I used the 2007 "REFEDIT.DLL". And now is working fine. I wrote the MACRO in 2003, but it worked just with the 2007 "REFEDIT.DLL"
I have just tried it on 2007 SP2, worked fine.
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber