+ Reply to Thread
Results 1 to 11 of 11

How to find the cell with note and put them all into 1 cell with differnce line

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    How to find the cell with note and put them all into 1 cell with differnce line

    Hi,
    I'm looking for help how to find the notes then put them together into 1 cell in difference line.

    Regards,
    tt3
    Attached Files Attached Files
    Last edited by tuongtu3; 11-05-2012 at 02:06 AM. Reason: Solved

  2. #2
    Registered User
    Join Date
    08-28-2012
    Location
    Sri Lanka
    MS-Off Ver
    Excel 2010
    Posts
    57

    Re: How to find the cell with note and put them all into 1 cell with differnce line

    Hi

    sorry to say your sample sheet does not give a clear pic on what you want to do.
    Hope you can do this using VLOOKUP & CONCATENATE functions.

    if you can post a sample sheet with little more clarification on it, it would be help to sort out this urgently.

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

    Re: How to find the cell with note and put them all into 1 cell with differnce line

    try
    Sub test()
        Dim rng As Range, r As Range, txt As String
        Range("u14").ClearContents
        Set rng = Range("u15", Range("u" & Rows.Count).End(xlUp)).SpecialCells(2)
        If rng Is Nothing Then Exit Sub
        For Each r In rng
            txt = Join$(Array(txt, Join$(Array(r(, -18).Value, r.Value), ": ")), vbLf)
        Next
        Range("u14").Value = Mid$(txt, 2)
        Set rng = Nothing
    End Sub

  4. #4
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: How to find the cell with note and put them all into 1 cell with differnce line

    as an option, UDF
    Function CombineText(r1 As Range, r2 As Range) As String
    Dim x, y, i&, s$
    x = r1.Value: y = r2.Value
    If UBound(x) <> UBound(y) Then CombineText = "###": Exit Function
    For i = 1 To UBound(y)
        If Len(y(i, 1)) Then s = s & vbCrLf & x(i, 1) & ": " & y(i, 1)
    Next
    If Len(s) Then CombineText = Mid(s, 3) Else CombineText = "###"
    End Function

  5. #5
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: How to find the cell with note and put them all into 1 cell with differnce line

    Private Sub CommandButton1_Click()
        'Below is working perfect but missing ***
        Dim rng1 As Range, r As Range, txt As String
        Range("u14").ClearContents
        Set rng1 = Range("u15", Range("u" & Rows.Count).End(xlUp)).SpecialCells(2)
        If rng1 Is Nothing Then Exit Sub
        For Each r In rng1
            txt = Join$(Array(txt, "***" & Join$(Array(r(, -18).Value, r.Value), ": ")), vbLf)
        Next
        Range("u14").Value = Mid$(txt, 2)
        Set rng1 = Nothing
    End Sub
    Hi Prashantha
    Thank you for the reply and I will try to be more clear.

    @Jindon
    Thank you very much for the help. I have been able to get the 3 stars (***) at the beginning of each text line but cannot figure out how to put them at the end of each text line. Can you please help? Thank you.

    @nilem
    Thank you for your help. Can you teach me how to use your function?

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

    Re: How to find the cell with note and put them all into 1 cell with differnce line

    Change
    txt = Join$(Array(txt, Join$(Array(r(, -18).Value, r.Value), ": ")), vbLf)
    to
    txt = Join$(Array(txt, Join$(Array("***" & r(, -18).Value, Trim$(r.Value)), ": ") & "***"), vbLf)

  7. #7
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: How to find the cell with note and put them all into 1 cell with differnce line

    Quote Originally Posted by jindon View Post
    Change
    txt = Join$(Array(txt, Join$(Array(r(, -18).Value, r.Value), ": ")), vbLf)
    to
    txt = Join$(Array(txt, Join$(Array("***" & r(, -18).Value, Trim$(r.Value)), ": ") & "***"), vbLf)
    Hi Jindon,
    The new code is perfect and thank you very much for your help. When I transfer to another sheet then all text merge together so how can i break them from ***Honda01: PartXXX******Honda01: PartYYY to

    ***Honda01: PartXXX***
    ***Honda02: PartYYY***

    Regards,
    tt3

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

    Re: How to find the cell with note and put them all into 1 cell with differnce line

    Sorry, but I don't understand what you are asking.

    Can you upload the file again?

  9. #9
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: How to find the cell with note and put them all into 1 cell with differnce line

    Quote Originally Posted by jindon View Post
    Sorry, but I don't understand what you are asking.

    Can you upload the file again?
    Hi Jindon,
    Please look at cell X13 in the file. and one thing is I want cell "U14" is empty if there's no notes in column "U:U" because I see note "***Car: Remark/Notes***" in cell U14 instead it shoud be empty.

    Regards,
    tt3
    Attached Files Attached Files
    Last edited by tuongtu3; 11-03-2012 at 12:38 PM. Reason: more clarification

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

    Re: How to find the cell with note and put them all into 1 cell with differnce line

    Change to
    Private Sub CommandButton1_Click()
        Dim rng As Range, r As Range, txt As String
        Range("u14").ClearContents
        On Error Resume Next
        Set rng = Range("u15", Range("u" & Rows.Count)).SpecialCells(2)
        On Error GoTo 0
        If rng Is Nothing Then Exit Sub
        For Each r In rng
            txt = Join$(Array(txt, Join$(Array("***" & r(, -18).Value, Trim$(r.Value)), ": ") & "***"), vbLf)
        Next
        Range("u14").Value = Mid$(txt, 2)
        Set rng = Nothing
    End Sub

  11. #11
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: How to find the cell with note and put them all into 1 cell with differnce line

    Quote Originally Posted by jindon View Post
    Change to
    Private Sub CommandButton1_Click()
        Dim rng As Range, r As Range, txt As String
        Range("u14").ClearContents
        On Error Resume Next
        Set rng = Range("u15", Range("u" & Rows.Count)).SpecialCells(2)
        On Error GoTo 0
        If rng Is Nothing Then Exit Sub
        For Each r In rng
            txt = Join$(Array(txt, Join$(Array("***" & r(, -18).Value, Trim$(r.Value)), ": ") & "***"), vbLf)
        Next
        Range("u14").Value = Mid$(txt, 2)
        Set rng = Nothing
    End Sub
    Hi jindon,
    The above code is work perfect as I expected. Thank you very much for your time and help.

    Best regards,
    tt3

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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