Results 1 to 3 of 3

VBA code to amend named range

Threaded View

  1. #1
    Registered User
    Join Date
    12-18-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    5

    VBA code to amend named range

    Hi All,

    Sure this will be a simple query but I can't get my code to work. I'm not great at coding (self taught) but can find my own way normally by recording and Googling! I have a named range ("SalesPeople") that I want to alter once a new sales person is added to the data. My code is currently thus:-

    ActiveWorkbook.Names("Salespeople").Refers to R1C1 = "=DATA!R1C5:R8C5

    Effectively my current list of sales people populate E1:E8 on the DATA worksheet. My macro currently makes a number of changes to the workbook to incorporate this new salesperson however I need the above code to change the named range to incorporate the new salesperson whose name is sat in E9. I want the code to essentially rename the range to E1: end of selection ie, E9. Next time a new sales person starts the range would rename to E1:E10 etc etc. Not sure if I need to count the number of cells or maybe use some form of Selection.End(xlDown)?

    The named range is used for Data Validation when assigning a sale to the relevant sales person by the way.

    Any help that could be afforded to me would be most appreciated!

    Regards
    Paul

    ** EDIT - Forgot to mention file is currently 5MB so I can't post to the thread unfortunately! **
    Last edited by pdean52; 04-01-2015 at 12:46 PM. Reason: Forgot to mention cant attach file.....!!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Amend code to do nothing if cells in a range are empty
    By nickmax1 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-05-2015, 07:38 AM
  2. How to amend coding for Data Validation refer to a Named Range?
    By montroseite in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-15-2010, 09:35 AM
  3. Using a named range in VBA code
    By TripleC in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-26-2010, 04:41 PM
  4. Amend code to change range from Col D to a Range
    By Redd in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-05-2009, 05:34 PM
  5. Macro code to change cell range to named range
    By Orlic in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-25-2008, 11:51 AM

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