+ Reply to Thread
Results 1 to 12 of 12

Delete all user-defined variables

  1. #1
    Forum Contributor HerryMarkowitz's Avatar
    Join Date
    09-10-2012
    Location
    Europe
    MS-Off Ver
    Office 2021 - Win10
    Posts
    1,007

    Delete all user-defined variables

    Hi,
    Is there an one simple code which provide deleting all user-defined variables once ?
    Regards.


    I mean clear all user-defined variables from excel cache...
    Last edited by HerryMarkowitz; 12-26-2013 at 08:03 AM.
    Sub DontForgetThese()
         If Your thread includes any code Then Please use code tags...
         If Your thread has been solved Then Please mark as solved...
         If Anybody has helped to you Then Please add reputation...
    End Sub

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Delete all user-defined variables

    See here after a macro to do the list of the names and another one to delete name which ARE in column "B" in the sheet where are the names
    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Forum Contributor HerryMarkowitz's Avatar
    Join Date
    09-10-2012
    Location
    Europe
    MS-Off Ver
    Office 2021 - Win10
    Posts
    1,007

    Re: Delete all user-defined variables

    Hi PCI,
    I didnt say clear names...
    I said clear user-defined variables from excel vba cache...
    Thanks anyway.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    What VBA cache?
    If posting code please use code tags, see here.

  5. #5
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Delete all user-defined variables

    Can you send a short example to high light the issue you are running into

  6. #6
    Forum Contributor HerryMarkowitz's Avatar
    Join Date
    09-10-2012
    Location
    Europe
    MS-Off Ver
    Office 2021 - Win10
    Posts
    1,007

    Re: Delete all user-defined variables

    My question was so simple.
    Lets make an example.
    There is a Set ws = Nothing line at the end of folllowing code.
    That line set ws to nothing.
    Please Login or Register  to view this content.
    So, how can I set all user-defined variables to nothing ?
    I need a code like this;
    Please Login or Register  to view this content.
    BR
    Last edited by HerryMarkowitz; 12-26-2013 at 12:43 PM.

  7. #7
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Delete all user-defined variables


    Hi,

    see the End statement …

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Delete all user-defined variables

    Or push the Reset button on the VBE Standard Toolbar, or Run > Reset
    Entia non sunt multiplicanda sine necessitate

  9. #9
    Forum Contributor HerryMarkowitz's Avatar
    Join Date
    09-10-2012
    Location
    Europe
    MS-Off Ver
    Office 2021 - Win10
    Posts
    1,007

    Re: Delete all user-defined variables

    Hi Marc L,
    I have no idea what you are trying to say...

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Delete all user-defined variables

    The End statement executed anywhere resets all project variables.
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    04-24-2007
    Location
    NYC
    MS-Off Ver
    2k3/2k7/2010
    Posts
    270

    Re: Delete all user-defined variables

    You want to set all variables to null value. I take it that you are probably using global variables. I would suggest that you write a sub that will empty out all your global variables and all you will need to do is call that sub whenever you need.

    If you need to empty out a variable multiple times in a single sub i would suggest you rewrite your code so the variables don't have to be constantly emptied out. Instead write it in a way so you can re-run the sub multiple times, and every instance will start with empty values by default.

  12. #12
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Herry

    In your example there's no need for the line setting ws to Nothing.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. User defined variables in a path reference
    By CaddyMatt in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-23-2012, 02:08 PM
  2. How do you input user defined variables into an AutoFilter statement?
    By trhoades in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-14-2010, 11:26 PM
  3. User-defined variables in MS access query
    By ratzy in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-11-2007, 11:13 AM
  4. Replies: 6
    Last Post: 06-28-2006, 03:15 PM
  5. Replies: 0
    Last Post: 04-12-2005, 08:06 PM

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