+ Reply to Thread
Results 1 to 7 of 7

Changing a Public Const As String to a Range

  1. #1
    Forum Contributor
    Join Date
    08-10-2017
    Location
    Lansing, Michigan
    MS-Off Ver
    2016
    Posts
    140

    Changing a Public Const As String to a Range

    Someone wrote this for me and I am simply trying to have it function the same, but have it take the text from a range of cells from a specific sheet rather than typing the set text into VBA since other people will need to change this texts. I dont understand how this works quite yet and am asking for help.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Changing a Public Const As String to a Range

    Uncomment this line
    Please Login or Register  to view this content.
    Change this line to
    Please Login or Register  to view this content.
    Then change this part
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  3. #3
    Forum Contributor
    Join Date
    08-10-2017
    Location
    Lansing, Michigan
    MS-Off Ver
    2016
    Posts
    140

    Re: Changing a Public Const As String to a Range

    Thank you for the reply. I guess I'm confused on where I put the range it's pulling the text from.

    And to be clear, by "Uncomment", do you mean "Delete"?

  4. #4
    Forum Contributor
    Join Date
    08-10-2017
    Location
    Lansing, Michigan
    MS-Off Ver
    2016
    Posts
    140

    Re: Changing a Public Const As String to a Range

    I apologize, the code above is in a module. There is also more code in the ThisWorkbook module that this needs to work which also uses "myList".

    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Changing a Public Const As String to a Range

    Try to follow the code by pressing F8 and notice the changes and if you encountered an error copy that line or try to change it to suit your needs
    It is better to upload sample workbook so as to try working on it

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent SAC
    Posts
    8,885

    Re: Changing a Public Const As String to a Range

    You could do this:

    Please Login or Register  to view this content.
    Change the blue parts as necessary. I'd strongly suggest a named range so that you can amend that in the UI without having to alter the code at all.
    Rory

  7. #7
    Forum Contributor
    Join Date
    08-10-2017
    Location
    Lansing, Michigan
    MS-Off Ver
    2016
    Posts
    140

    Re: Changing a Public Const As String to a Range

    Thank you both so much! I have figured it out and it works great.

+ 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] How to have dynamic Public Const
    By VAer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-09-2017, 09:38 AM
  2. Set Const Delimiter as line break (non-string)
    By KDDB in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-08-2016, 04:53 AM
  3. [SOLVED] Public Const Declaration of Workbooks, Worksheets, Ranges, etc.
    By AlvaroSiza in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2013, 03:02 PM
  4. Trying to link a variable to a public const
    By ttd in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-27-2012, 11:44 AM
  5. public const
    By jocke in forum Excel General
    Replies: 1
    Last Post: 12-06-2006, 01:17 AM
  6. public const availability?
    By lcoreyl in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-01-2006, 11:22 AM
  7. how to declare Pub Const String Array ?
    By dick in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-24-2005, 02:05 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