+ Reply to Thread
Results 1 to 7 of 7

Define only 2 named ranges from a list of named ranges...

  1. #1
    Registered User
    Join Date
    02-27-2014
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    22

    Define only 2 named ranges from a list of named ranges...

    Hi,
    I have written this macro to convert into a csv file to run for all defined named ranges in the activesheet. It run jst perfect when I hit SAVE button and it creates that many different CSV files for each named range.

    However I am trying to use same macro in the another file and the problem I am facing is there a lot more named ranges and I want to run the macro for only selected NAMED RANGE. In this case 2 Named Range / 24 Named range.

    Can you advise on what part of code do I need to change and to what to make it work for jst 2 named ranges ?

    Please Login or Register  to view this content.
    I want to run for NAMED RANGE - CMMDTY and BUSGROUP only.

    please advise

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Define only 2 named ranges from a list of named ranges...

    Just add a simple condition, one way to do it is:

    Please Login or Register  to view this content.
    多么想要告诉你 我好喜欢你

  3. #3
    Registered User
    Join Date
    02-27-2014
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Define only 2 named ranges from a list of named ranges...

    Hi,

    thanks for the update, however I am now getting an error as "Select method of range class failed."


    getting error on this line :-
    Please Login or Register  to view this content.
    Is it due to the fact that I have the named ranges in 2 different sheets and not all of them in active worksheet ?

    But then I thought the macro should still work irrespective but alas !!

    I have this code under MODULE 1 and Under THISWORKBOOK I have the Call function as :
    Please Login or Register  to view this content.

  4. #4
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Define only 2 named ranges from a list of named ranges...

    Try changing to this see if it helps
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-27-2014
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Define only 2 named ranges from a list of named ranges...

    Fantastic IT worked..!!

  6. #6
    Registered User
    Join Date
    02-27-2014
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Define only 2 named ranges from a list of named ranges...

    Hi,
    as per the code above I am jst wondering if the file gets saved to my local or specified drive location as well as to the location that i mentioned in the macro.

    I know that the csv files gets saved in the location mentioned in the macro.. however how do I know if the file has been saved to my local drive as well or if I want to specify SAVE AS to a different location then will it run macro again ? and wont it will ask me to overwrite the existing CSV files again and again ?

    sorry but did I confuse it even more ?

    please advise

  7. #7
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Define only 2 named ranges from a list of named ranges...

    Don't really quite get your question, do you mean you do not know what the macro does when is it written by you?

    Currently the file will be saved to this directory.
    Please Login or Register  to view this content.
    If you have already an existing file with the same name, and with alerts enabled, it should be asking you whether you want to overwrite it, this can also be handled using the ConflictResolution argument of the SaveAs method if I am not wrong.

    If you want it to be saved to two locations, just add another SaveAs statement. This is just for example.
    Please Login or Register  to view this content.

+ 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. Looping Mutliple Named Resized Ranges in next empty row below another named range
    By gingumdog in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-19-2014, 08:15 PM
  2. [SOLVED] Determining if the value of a cell can be a named range, then assigning named ranges after
    By Romulo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-15-2013, 06:05 PM
  3. Replies: 1
    Last Post: 05-22-2013, 01:49 AM
  4. List Named Ranges
    By martynduerden in forum Excel General
    Replies: 3
    Last Post: 07-15-2009, 01:03 PM
  5. Replies: 1
    Last Post: 03-21-2006, 06:40 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