+ Reply to Thread
Results 1 to 7 of 7

Clear cell contents based on defined name

  1. #1
    Registered User
    Join Date
    12-09-2009
    Location
    Palatine, Illinois
    MS-Off Ver
    Excel 2007
    Posts
    30

    Clear cell contents based on defined name

    Hello,

    I'm trying to clear cell contents based on a defined name given to a set of various cells in my worksheet. The cells are not continuous, but since they're given that defined name, I don't think it matters.

    The defined name is listed as "CommentsFields".
    The worksheet name is listed as "QPRForm_V6"

    I found a similar thread, but cannot get it to work with what I'm looking for. I'm relatively new to writing VBA/macros, so I'm not sure what to do.

    Any ideas are greatly appreciated!
    Last edited by SMB; 01-14-2010 at 12:48 PM.

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: Clear cell contents based on defined name

    I may be missing the point, but won't this

    Please Login or Register  to view this content.
    do what you want?
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    12-09-2009
    Location
    Palatine, Illinois
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Clear cell contents based on defined name

    Quote Originally Posted by sweep View Post
    I may be missing the point, but won't this

    Please Login or Register  to view this content.
    do what you want?
    I tried your above suggestion w/o the extra "..as seen below..and received a 400 error.


    Please Login or Register  to view this content.
    Then changed to the below..still received the 400 error.

    Please Login or Register  to view this content.
    Last edited by SMB; 01-13-2010 at 12:52 PM. Reason: Changed to new code..still same error.

  4. #4
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: Clear cell contents based on defined name

    That's odd. Is the workbook containing the named range active when you run the code?

  5. #5
    Registered User
    Join Date
    12-09-2009
    Location
    Palatine, Illinois
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Clear cell contents based on defined name

    Hi again,

    I scaled down the worksheet contents, due to work based restrictions, but what is attached should show the issues that I'm having..The workbook that contains the macro, defined name, and the sheet are the same and are active when I try to run it.

    The name CommentsFields selects all of the fields (mostly filled with asdf for example comments)

    Any suggestions?
    Attached Files Attached Files

  6. #6
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: Clear cell contents based on defined name

    You have merged cells which will have to be unmerged prior to clearing, like this,

    Please Login or Register  to view this content.
    or if you don't want to unmerge, this will work,


    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    12-09-2009
    Location
    Palatine, Illinois
    MS-Off Ver
    Excel 2007
    Posts
    30

    Thumbs up Re: Clear cell contents based on defined name

    Hi there, Thanks for the options!

    They worked..I added to your reputation. I appreciate the help. Thanks again!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1