Consulting

Results 1 to 11 of 11

Thread: Solved: Inserting more than one value into a single cell in an excel worksheet using VB.

  1. #1
    VBAX Newbie
    Joined
    Apr 2012
    Posts
    5
    Location

    Lightbulb Solved: Inserting more than one value into a single cell in an excel worksheet using VB.

    Hello everyone, I am new to vba programming. I've learnt a few things and have started coding. I've created a new excel sheet using VB, copied values from another excel sheet, saved it with some other names. Till now, it was working fine, but now I'm stuck with a problem - inserting more than one value into a single cell in an excel worksheet just like we use Alt + Enter in Excel. Could you please suggest how can I do that using VB??

    Regards,
    Diddo..

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,872
    if you record a macro of you entering stuff into a cell using Alt+Enter to split the line you'll get the likes of:[VBA]ActiveCell.FormulaR1C1 = "sdfs" & Chr(10) & "sdgfddd"[/VBA]where the Chr(10) is the linefeed.
    You could write it like this instead:
    [VBA]ActiveCell.FormulaR1C1 = "sdfs" & vblf & "sdgfddd"[/VBA]
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    VBAX Newbie
    Joined
    Apr 2012
    Posts
    5
    Location
    Thanx a lot shg, u have solved my problem.. I've a learnt new things VBCrlf,VBLf,VBCr.. thanx a ton..

  4. #4
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,050
    Location
    Who is shg?
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  5. #5
    VBAX Newbie
    Joined
    Apr 2012
    Posts
    5
    Location
    oops.. that's my mistake.. i was going through some other posts, and it was my mistake i wrote the name wrong..

    Sorry p45cal, thanx a lot for your help.. you rock..

  6. #6
    VBAX Newbie
    Joined
    Apr 2012
    Posts
    5
    Location
    @Aussiebear, I tried 2 mark the thread as solved, but the only options i am getting when i click on thread tools are : Search this thread and Rate this thread..

  7. #7
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,872
    Quote Originally Posted by Aussiebear
    Who is shg?
    The person who answered the cross post at http://www.excelforum.com/excel-prog...-using-vb.html
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  8. #8
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,050
    Location
    My what a small world we live in....

    BTW: diddo, if you feel the need to crosspost, please also post the link so that others do not necessarily waste their valuable time in responding when you already have assistance or worse still, a solution.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  9. #9
    VBAX Newbie
    Joined
    Apr 2012
    Posts
    5
    Location
    Yes, I did make that cross post as I'm new to dis type of forums (as you can see, i joined both the forums just 2days back) and i wasn't sure whether my qstn would be answered or not.. so, I posted the same qstn in both the forums..
    but I shld hav posted d link here as well.. dat's another mistake on my part.. Sorry for dat.. will keep dat in mind in future..n once again thanx for d answr..

  10. #10
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,050
    Location
    In an effort to assist everyone who visits the forum, can you also please use english as it is meant to be written. Its hard enough for those who's main language is not english, to then have to try and follow an abbreviated version.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  11. #11
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    unedited "copy-paste"s create problems...
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •