+ Reply to Thread
Results 1 to 3 of 3

Code to create named range using userform

  1. #1
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Code to create named range using userform

    Hi,

    So I have a document where I want the user to be able to create a new named range simply by Typing in the column letter into a userform. Problem I'm having is the refersto part of defining the name.

    Please Login or Register  to view this content.
    So this will work if A was selected in the userform, but if B for example was chosen then I need the C1 part to change to C2.

    Any help is greatly appreciated.

    Thanks

    Dave

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Code to create named range using userform

    Hi PFDave,

    You can do what you want by replacing 'C1' in the Original Formula with a text string (such as 'QQQ') that you know will never be used in the formula. Then replace the 'QQQ' with 'C1', or 'C2' etc as per the following example macro tested and working:
    Please Login or Register  to view this content.
    Lewis

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

    Re: Code to create named range using userform

    Try this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

+ 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. [SOLVED] VBA debug - Code to create a named range
    By The_Snook in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-23-2016, 10:56 AM
  2. [SOLVED] Compare cells to named range and create new sheets using related named range
    By drewship in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-10-2015, 03:35 PM
  3. Add items to named range from userform
    By wpryan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-08-2015, 07:19 AM
  4. [SOLVED] Create named range within VBA code
    By adelkam in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-16-2015, 01:52 PM
  5. [SOLVED] Used named range in listbox on userform
    By WilliamWu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-09-2013, 08:04 AM
  6. Enter a formula ad create a Named Range with code
    By Jogier505 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-02-2011, 06:04 PM
  7. Dyn Named Range update from userform
    By KD in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-07-2006, 04:20 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