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

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
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,223,708
Messages
6,174,002
Members
452,542
Latest member
Bricklin

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