Can I store multiline text in macro and paste it as plain text?

excelos

Well-known Member
Joined
Sep 25, 2011
Messages
592
Office Version
  1. 365
Platform
  1. Windows
Hi!

Can I store a multiline text which contains formulas and text and use a macro that will activate the A1 cell and then paste the multiline text?

Thanks!
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
This formula will store multi line text and the result of a formula.

Code:
Sub MultiLineText()


Dim x As Double


'This is where the formula you want will be ran.  The the result will be added to your "text/formula" cell
x = WorksheetFunction.Sum(Range("B1"), Range("C1"))


'Contains your text on one line and the result of you formula on a second line
Range("A1") = "Cell B1 plus cell C1 equal " & vbNewLine & x


'Widens the column so everything is visible and not wrapped
Columns("A").ColumnWidth = 22.5


End Sub
 
Upvote 0
This limits the text in 3 lines for A1, B1, C1?

That is not what I want.

I want to:
1) store the multiline text in a variable as simple text
2) paste that text in A1

The multiline text can be for example:
=COUNTIFS(UDE!$DO:$DO,"Forward",UDE!$G:$G,"High",UDE!$AI:$AI,"Sprint",UDE!$AC:$AC,"Approval") =COUNTIFS(UDE!$DO:$DO,"Backward",UDE!$G:$G,"High",UDE!$AI:$AI,"Sprint 1",UDE!$AC:$AC,"Approval")
=COUNTIFS(UDE!$DO:$DO,"Forward",UDE!$G:$G,"High",UDE!$AI:$AI,"Sprint",UDE!$AC:$AC,"Boarding") =COUNTIFS(UDE!$DO:$DO,"Backward",UDE!$G:$G,"High",UDE!$AI:$AI,"Sprint 1",UDE!$AC:$AC,"Boarding")


As you understand, I want to avoid converting the text into VBA R1C1 format which is a great pain for the 300 lines I want to insert in the sheet.
That's why, I want to insert the text as plain text into the clipboard and then paste it as simple text.

Any ideas?
 
Upvote 0

Forum statistics

Threads
1,224,749
Messages
6,180,731
Members
452,995
Latest member
isldboy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top