Macro to place varying text all the time into a single line from 2 orsometimes 3 lines

E

ezduzitez

This macro is used on D column only and goes from D5 down.

Could you also provide it in a format as if it was a single macro.

Sub Singlerow ()

(required text)

End sub


====================================================


Here are 6 examples separated by rows.
---------------------------
Ø1.40 +/-.01
(RELIEF)
---------------------------
Ø1.3114 +/-.0044
TO RELIEF
---------------------------
..46
MAX
- 2 PLACES
---------------------------
Ø1.2975 +/-.0075
(RELIEF)
---------------------------
..87415 +/-.00415
TO RELIEF
 
C

Claus Busch

Hi,

Am Wed, 19 Jun 2013 12:58:08 -0700 (PDT) schrieb (e-mail address removed):
This macro is used on D column only and goes from D5 down.

Could you also provide it in a format as if it was a single macro.

try:
Sub Singlerow()
Dim LRow As Long

LRow = Cells(Rows.Count, "D").End(xlUp).Row
Range("D5:D" & LRow).WrapText = False
Columns("D").AutoFit
End Sub


Regards
Claus Busch
 
E

ezduzitez

Hello Claus,

Thanks for your quick response :)

There's extra details that I failed to provide. The column width has to remain the same width for the standard form we are using. The text needs to wrap if needed to fit the cell making cell width fit wrapped text.

The text is in a single cell and is separated in the same way you would separate them using "Alt+Enter" so what needs to be done is remove the "Alt+enter" without affecting Column width and having text wrap.

IS =
..46
MAX
- 2 PLACES

S/B =
..46 MAX - 2 PLACES (WRAPPED IF NEEDED)

Thanks again.
 
C

Claus Busch

Hi,

Am Wed, 19 Jun 2013 13:33:25 -0700 (PDT) schrieb (e-mail address removed):
There's extra details that I failed to provide. The column width has to remain the same width for the standard form we are using. The text needs to wrap if needed to fit the cell making cell width fit wrapped text.

The text is in a single cell and is separated in the same way you would separate them using "Alt+Enter" so what needs to be done is remove the "Alt+enter" without affecting Column width and having text wrap.

then try:
Sub Singlerow()
Dim LRow As Long
Dim rngC As Range

LRow = Cells(Rows.Count, "D").End(xlUp).Row
For Each rngC In Range("D5:D" & LRow)
rngC = Replace(rngC, Chr(10), "")
Next
End Sub


Regards
Claus Busch
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top