+ Reply to Thread
Results 1 to 13 of 13

Vba code to output the text box containing selected data with comma.

  1. #1
    Forum Contributor satputenandkumar0's Avatar
    Join Date
    11-08-2012
    Location
    Pune, India
    MS-Off Ver
    Office xp & Office 2007
    Posts
    398

    Vba code to output the text box containing selected data with comma.

    Hi Forum,

    I need VBA code to output the text box contains the selected cells data with comma
    pls see attached file for more explanation.
    Attached Files Attached Files
    Regards,
    Nandkumar S.
    ---------------------------------------------------------------
    Don't forget to Click on * if you like my solution.

  2. #2
    Forum Contributor satputenandkumar0's Avatar
    Join Date
    11-08-2012
    Location
    Pune, India
    MS-Off Ver
    Office xp & Office 2007
    Posts
    398

    Re: Vba code to output the text box containing selected data with comma.

    If selected cells are

    M135380
    M136455
    M136456
    A821785
    M142353
    A974065
    M017029
    A135381
    A135351
    M135443


    I want below output in new text box.

    M135380,M136455,M136456,A821785,M142353,A974065,M017029,A135381,A135351,M135443

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Vba code to output the text box containing selected data with comma.

    Hi, satputenandkumar0,

    maybe like this
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Vba code to output the text box containing selected data with comma.

    Please Login or Register  to view this content.
    but you did not put a textbox in your attached file, but a shape.
    If solved remember to mark Thread as solved

  5. #5
    Forum Contributor satputenandkumar0's Avatar
    Join Date
    11-08-2012
    Location
    Pune, India
    MS-Off Ver
    Office xp & Office 2007
    Posts
    398

    Re: Vba code to output the text box containing selected data with comma.

    Thanks Holger,

    It works perfect.

  6. #6
    Forum Contributor satputenandkumar0's Avatar
    Join Date
    11-08-2012
    Location
    Pune, India
    MS-Off Ver
    Office xp & Office 2007
    Posts
    398

    Re: Vba code to output the text box containing selected data with comma.

    Thanks patel45 for givng solution.

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Vba code to output the text box containing selected data with comma.

    Hi, satputenandkumar0,

    if you want to use the code in any other workbook make sure to know the running number of the shape.

    @patel45,
    nice bit of macro-recorder code with a loop and not dimmed variables. The last comma from the string should be omitted.

    Ciao,
    Holger

  8. #8
    Forum Contributor satputenandkumar0's Avatar
    Join Date
    11-08-2012
    Location
    Pune, India
    MS-Off Ver
    Office xp & Office 2007
    Posts
    398

    Re: Vba code to output the text box containing selected data with comma.

    ok sir,

    Thanks for advice.

  9. #9
    Forum Contributor satputenandkumar0's Avatar
    Join Date
    11-08-2012
    Location
    Pune, India
    MS-Off Ver
    Office xp & Office 2007
    Posts
    398

    Re: Vba code to output the text box containing selected data with comma.

    Sir,

    Is it possible that output will come with new notepad file every time I run code.

  10. #10
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Vba code to output the text box containing selected data with comma.

    Hi, satputenandkumar0,

    yes - it is. But isnīt that a different topic than sending the text to a shape?

    Please Login or Register  to view this content.
    You might need to change the path and folder as well as check the location of Notepad.exe

    Ciao,
    Holger

  11. #11
    Forum Contributor satputenandkumar0's Avatar
    Join Date
    11-08-2012
    Location
    Pune, India
    MS-Off Ver
    Office xp & Office 2007
    Posts
    398

    Re: Vba code to output the text box containing selected data with comma.

    sir,

    getting below error

    Run-time error '76':
    Path not found

  12. #12
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Vba code to output the text box containing selected data with comma.

    Hi, satputenandkumar0,

    Quote Originally Posted by Post#10
    You might need to change the path and folder as well as check the location of Notepad.exe
    If you donīt have the directory Temp on your local HDD in Drive C: the error is understandable - or did you miss the backslash at the end of the path?

    Ciao,
    Holger

  13. #13
    Forum Contributor satputenandkumar0's Avatar
    Join Date
    11-08-2012
    Location
    Pune, India
    MS-Off Ver
    Office xp & Office 2007
    Posts
    398

    Re: Vba code to output the text box containing selected data with comma.

    ok sir, it's done

    I remove "\" in below code.

    Please Login or Register  to view this content.
    Now it's work nice

    Thanks a lot

+ 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