Excel VBA HOW TO PRINT THE TEXT IN A CELL like Wrap Text

0 votes

When the code is executed, the text "AASD FDG HJK LSDH YTWIN" appears in a cell, however, I need the words to appear in a cell enclosed like:

AASD
FDG
HJK
LSDH
YTWIN

This is one cell. what changes needs to be done to get like that for this code:

Ws.Range("E" & R).Value = "AASD FDG HJK LSDH YTWIN " 
Oct 27 in Others by Kithuzzz
• 20,660 points
77 views

1 answer to this question.

0 votes

Use a LineFeed character to create a line break in an Excel cell. In VBA, a constant vbLf is defined for that. Additionally, the cell's WrapText attribute must be set.

So you can use:

With ws.Range("E" & R) 
    .WrapText = True
    .Value = "AASD" & vbLf & "FDG" & vbLf & "HJK" & vbLF & "LSDH" & vbLF & "YTWIN"
    ' Or use
    .Value = Replace("AASD FDG HJK LSDH YTWIN ", " ", vbLf) 
end With
answered Oct 27 by narikkadan
• 37,660 points

Related Questions In Others

0 votes
1 answer

How to retrieve the value of a text field in Flutter App?

Hi@akhtar, In your TextField, you can call one ...READ MORE

answered Sep 3, 2020 in Others by MD
• 95,380 points
1,021 views
0 votes
1 answer

How to print an Excel Sheet using VBA with Nitro PDF Creator in Excel 2016

you can use the built-in excel facilities ...READ MORE

answered Sep 24 in Others by narikkadan
• 37,660 points
123 views
0 votes
1 answer
0 votes
1 answer

Append same text to every cell in a column in Excel

Solution All your data is in column A ...READ MORE

answered Oct 17 in Others by narikkadan
• 37,660 points
68 views
0 votes
1 answer

Retrieve epay.info Balance with VBA and Excel

This code should log you in, provided ...READ MORE

answered Sep 5, 2018 in Blockchain by digger
• 26,720 points
452 views
0 votes
1 answer

How to load file to Excel Power query from SFTP site

Currently, I don't think there is a ...READ MORE

answered Dec 3, 2018 in Power BI by Upasana
• 8,620 points
2,220 views
0 votes
1 answer

Using VBA Excel to create a gramatically correct list

The Excel AND function is a logical ...READ MORE

answered Feb 9 in Others by gaurav
• 22,040 points
69 views
0 votes
2 answers

How to copy a formula horizontally within a table using Excel VBA?

Hi so basically, create an adjacent column ...READ MORE

answered Feb 16 in Others by Edureka
• 13,640 points
207 views
0 votes
1 answer
0 votes
1 answer

How to insert a new row in the specified cell only, of Excel sheet using c#?

I have this worksheet with a matrix ...READ MORE

answered Nov 24 in Others by narikkadan
• 37,660 points
26 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP