+ Reply to Thread
Results 1 to 12 of 12

How to delete one row in a string?

  1. #1
    Valued Forum Contributor
    Join Date
    02-21-2010
    Location
    Tokyo, Japan
    MS-Off Ver
    Excel 2007
    Posts
    502

    How to delete one row in a string?

    I have column headers that are generated by an analytical bio-assay machine.
    Some of the header cells have 2 rows. The first row contains the title and the second row contains a measurement unit.
    See columns C and E in screenshot below.

    Capture.PNG

    The content and the number of characters in the first row and in the second row is variable.

    Is there a way to copy only the first row into a new cell?

    In the screenshot below is shown how I want the column C and E header cells to look like.

    Capture2.PNG

  2. #2
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: How to delete one row in a string?

    Can you attach a small sample of your data with the headers as you get raw?

    Go Advanced -> Manage Attachments -> Upload

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: How to delete one row in a string?

    Ctrl + H (Find & Replace)
    Enter Alt + 0010 (0010 must be entered from number key pad) followed by an asterisk *

  4. #4
    Valued Forum Contributor
    Join Date
    02-21-2010
    Location
    Tokyo, Japan
    MS-Off Ver
    Excel 2007
    Posts
    502

    Re: How to delete one row in a string?

    I attached an example file.
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor
    Join Date
    02-21-2010
    Location
    Tokyo, Japan
    MS-Off Ver
    Excel 2007
    Posts
    502

    Re: How to delete one row in a string?

    jindon, I need a VBA solution. This is just a small piece in a larger VBA

  6. #6
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: How to delete one row in a string?

    Quote Originally Posted by dschmitt View Post
    I attached an example file.
    I thought you might provide some more rows of data so we could help with more than just the first row. Don't you want to keep the data from the header cells too?

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: How to delete one row in a string?

    You could record it...
    Please Login or Register  to view this content.

  8. #8
    Valued Forum Contributor
    Join Date
    02-21-2010
    Location
    Tokyo, Japan
    MS-Off Ver
    Excel 2007
    Posts
    502

    Re: How to delete one row in a string?

    I have everything else under control. The only thing I need help with is in removing the second row in the string.
    I wonder whether the string contains a carriage return that could be used to delete the second row.

  9. #9
    Valued Forum Contributor
    Join Date
    02-21-2010
    Location
    Tokyo, Japan
    MS-Off Ver
    Excel 2007
    Posts
    502

    Re: How to delete one row in a string?

    jindon, great, thank you. That works. My hunch about the carriage return was right. But I did not know how to do it. Now that I see it it is obvious.

    One last question. What is the 2 for at the end of the replace function?

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: How to delete one row in a string?

    2 is for xlPart, 1 for xlWhole.

  11. #11
    Valued Forum Contributor
    Join Date
    02-21-2010
    Location
    Tokyo, Japan
    MS-Off Ver
    Excel 2007
    Posts
    502

    Re: How to delete one row in a string?

    I see. I did not know that. Well thanks again. I learned something new today!

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: How to delete one row in a string?

    You are welcome and thanks for the rep.

+ 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. Replies: 2
    Last Post: 05-27-2016, 12:30 AM
  2. [SOLVED] Grab last word from string and then delete word from original string.
    By mtilbury in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 09-14-2015, 04:14 AM
  3. [SOLVED] how to delete part of a string in a row
    By sumesh56 in forum Excel General
    Replies: 17
    Last Post: 10-24-2014, 02:48 AM
  4. Replies: 7
    Last Post: 07-25-2014, 08:21 AM
  5. Delete rows containing same string
    By rowdy2k5 in forum Excel General
    Replies: 1
    Last Post: 11-14-2011, 07:59 PM
  6. how to delete a string from another string
    By Ribap in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-23-2006, 06:50 AM
  7. Delete value in a string
    By Todd Huttenstine in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-31-2006, 03:35 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