Consulting

Results 1 to 15 of 15

Thread: RefEdit control to clear contents

  1. #1

    RefEdit control to clear contents

    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

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    [VBA]Private Sub CommandButton1_Click()
    Dim r As Range
    Set r = Range(RefEdit1.Value)
    r.ClearContents
    Unload Me
    End Sub[/VBA]

  3. #3
    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

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    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

  5. #5
    No, my worksheets isn't protected
    Try to select more than two ranges

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    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

  7. #7
    I got the following error

  8. #8
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    Maybe you selected cells where some were merged?

  9. #9
    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

  10. #10
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    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

  11. #11
    OK my dear
    This is my workbook

  12. #12
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    Your example worked fine for me.

  13. #13
    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!!

  14. #14
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    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"

  15. #15
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •