+ Reply to Thread
Results 1 to 6 of 6

Can't set Range Name as "Header cell" and suffix without changing Header itself

  1. #1
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365 Version 2501 64-bit
    Posts
    1,474

    Can't set Range Name as "Header cell" and suffix without changing Header itself

    Anyone know how to create a Range Name in VBA using the Header Cell and a suffix WITHOUT changing the Header cell itself?

    (E.g. Cells A1 - A10 have header "Less Time". I want the range to be ""Less Time Filter", but can't see how to combine the Header ("Less Time") with the Suffix (" Filter") without changing the Header itself?
    .
    Tried the "CreateNames" approach (Selection.CreateNames Sheet2.Cells(1, 1) & "_Filter"), but it generates an error

    All solutions, suggestions and alternatives received gratefully as ever

    Ochimus

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,790

    Re: Can't set Range Name as "Header cell" and suffix without changing Header itself

    Named ranges cannot have spaces. One way is like
    Please Login or Register  to view this content.
    But it depends on what you are trying to do

  3. #3
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365 Version 2501 64-bit
    Posts
    1,474

    Re: Can't set Range Name as "Header cell" and suffix without changing Header itself

    Fluff,

    Many thanks for prompt response, but it doesn't do what I explained?

    As I said in the original post, I do NOT want to change the content of the Header Cell.

    I want to create a Range Name that combines the wording of the Header cell with a Suffix (E.g. Cell says ""Less Time", Suffix is "_Filter", so Range Name becomes "Less Time_Filter".

    So the cell will still say "Less Time", but the Range including it will be called "Less Time_Filter"

    Hope this clarifies?

    Ochimus

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,790

    Re: Can't set Range Name as "Header cell" and suffix without changing Header itself

    Firstly
    As I said in the original post, I do NOT want to change the content of the Header Cell.
    The code I supplied does NOT change the content of the cell (as per you request)!

    Secondly, did you read my reply? namely
    Named ranges cannot have spaces.

  5. #5
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365 Version 2501 64-bit
    Posts
    1,474

    Re: Can't set Range Name as "Header cell" and suffix without changing Header itself

    Fluff,

    Many thanks for clarification, and especially for drawing my attention to the space in the Header itself.

    I was so focused on attaching the suffix I missed that completely! Which is why my initial attempts fell over.

    Just had to expand your snippet to check whether a Header started with a number, in which case it adds an initial underscore, but everything now works seamlessly and I can mark this as Solved.

    Ochimus

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,790

    Re: Can't set Range Name as "Header cell" and suffix without changing Header itself

    Glad it's sorted & thanks for the feedback

+ 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. Countif based on column header with "unknown" range position
    By campelliann in forum Excel General
    Replies: 2
    Last Post: 11-28-2015, 04:21 AM
  2. [SOLVED] "Read" the column header "Element" and perform calculation
    By dwsf in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-15-2015, 01:41 AM
  3. [SOLVED] Replace all BLANK cells in column with header title "Balance" to "0"
    By ks100 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-21-2014, 09:25 AM
  4. Return Column Header for Cell Range that equals "1"
    By kibbles in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-11-2013, 11:10 AM
  5. I need to copy a range of cells starting from a header row to "sheet2"
    By goldbeje in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-29-2012, 05:32 PM
  6. [SOLVED] Delete the Rows If it is Blank cell below Table header "Status"
    By eltonlaw in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-19-2012, 05:55 AM
  7. Replies: 12
    Last Post: 10-26-2010, 02:54 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