+ Reply to Thread
Results 1 to 2 of 2

naming a row based on left most string

  1. #1
    Registered User
    Join Date
    07-19-2012
    Location
    Washington DC
    MS-Off Ver
    Excel 2013
    Posts
    36

    naming a row based on left most string

    Hello Folks,


    So I have a code that works for all but one situation. This code names the row in a region of data. (JosephP was nice enough to guide me on how to do this of a whole region, but I still have to be able to do it for a whole row.

    Please Login or Register  to view this content.

    My solution is to say: if you are at the most left column, then skip the left shift. I do this because if you implement the End(xlToLeft) when you are at the left most point of a region you go somewhere else. No good.

    Please Login or Register  to view this content.
    I though that this numeric statement would work but it doesn't. It says an object is required and I'm uncertain why.

    If someone could help with this, I would be immensely grateful. Something tells me I'm doing something silly, but who knows. Thank you in advance.
    Last edited by Romulo; 09-11-2013 at 08:55 PM.

  2. #2
    Forum Contributor
    Join Date
    03-21-2012
    Location
    Ho Chi Minh city
    MS-Off Ver
    Excel 2003
    Posts
    180

    Arrow Re: naming a row based on left most string

    PHP Code: 
    Sub HorizontalNaming()
    Dim Horng As Range

    ActiveCell
    .Select

    If Selection.Offset(,-1).Value <> "" then 
       Selection
    .End(xlToLeft).Select                 '<=|'
    End If

    Set Horng Range(SelectionSelection.End(xlToRight))
    With Horng
        
    .Resize(, .Columns.Count 1).Offset(, 1).Name "'" & .Worksheet.Name "'!" & .Cells(1).Value
    End With
    End 
    If
    End Sub 

+ 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] Macro to match left string
    By tuneloon in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-17-2013, 11:32 AM
  2. Need 9th Charachter from LEFT in text string
    By floridagunner in forum Excel General
    Replies: 4
    Last Post: 04-27-2011, 11:33 AM
  3. removing 4 characters from the left of a string
    By mfish2010 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-03-2010, 07:16 PM
  4. [SOLVED] Remove left text string
    By Luc in Oxford in forum Excel General
    Replies: 2
    Last Post: 08-23-2005, 06:05 AM
  5. Left and right side of string?
    By Sasolini in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-23-2005, 08:15 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