PDA

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



diddo
04-28-2012, 01:35 PM
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.. :)

p45cal
04-28-2012, 02:19 PM
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:ActiveCell.FormulaR1C1 = "sdfs" & Chr(10) & "sdgfddd"where the Chr(10) is the linefeed.
You could write it like this instead:
ActiveCell.FormulaR1C1 = "sdfs" & vblf & "sdgfddd"

diddo
04-28-2012, 11:08 PM
Thanx a lot shg, u have solved my problem.. I've a learnt new things VBCrlf,VBLf,VBCr.. thanx a ton.. :)

Aussiebear
04-28-2012, 11:14 PM
Who is shg?

diddo
04-29-2012, 12:50 AM
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..:super:

diddo
04-29-2012, 12:53 AM
@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..

p45cal
04-29-2012, 04:15 AM
Who is shg? The person who answered the cross post at http://www.excelforum.com/excel-programming/827959-inserting-more-than-one-value-into-a-single-cell-in-an-excel-worksheet-using-vb.html

Aussiebear
04-29-2012, 04:43 AM
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.

diddo
04-29-2012, 01:59 PM
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..:banghead: will keep dat in mind in future..n once again thanx for d answr..:thumb

Aussiebear
04-29-2012, 04:11 PM
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.

mancubus
04-29-2012, 11:29 PM
unedited "copy-paste"s create problems...
:devil2: