Results 1 to 8 of 8

Extract the first part of a worksheet name up to first space

Threaded View

  1. #1
    Registered User
    Join Date
    02-20-2019
    Location
    Atlanta, Georgia
    MS-Off Ver
    Office 365
    Posts
    2

    Extract the first part of a worksheet name up to first space

    I have multiple sheets that need to renamed up the first space in the current name. For example, for a worksheet named: 'abc text more text', I want to keep 'abc'. I have to do this for multiple sheets and the number of characters before the space varies. I was able to use vba to pull the left most characters:
    Sub test()
    Dim ws As Object
    For Each ws In ActiveWorkbook.Worksheets
    ws.Name = Left(ws.Name, 5)
    Next ws
    End Sub
    but I can't see how to modify this to stop at space, similar to how this is done in this formula: =LEFT(A1,(FIND(" ",A1,1)-1))

    any thoughts? I'm sure it's a simple fix!
    Last edited by Leith Ross; 02-21-2019 at 02:57 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 27
    Last Post: 05-24-2018, 05:09 PM
  2. [SOLVED] Vlookup to only first part of the string (up to the first space)
    By mcranda in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-02-2013, 09:56 AM
  3. [SOLVED] Insert space in part numbers
    By Allgermanparts in forum Excel General
    Replies: 4
    Last Post: 06-19-2013, 09:00 AM
  4. Need to extract and save part of a worksheet
    By ghutchinson in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-26-2011, 05:25 AM
  5. Excel 2007 : Extract part of Worksheet
    By Cpinus in forum Excel General
    Replies: 3
    Last Post: 09-10-2010, 01:48 PM
  6. Extract part of a Worksheet name.
    By Casey in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-17-2006, 07:20 PM
  7. [SOLVED] Removing Space:-a list of part number
    By KL Cheong in forum Excel General
    Replies: 7
    Last Post: 04-28-2006, 02:35 AM

Tags for this Thread

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