ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting a row in a message (opposite to VbCrLf) (https://www.excelbanter.com/excel-programming/406102-deleting-row-message-opposite-vbcrlf.html)

Wesslan

Deleting a row in a message (opposite to VbCrLf)
 
Hi,

I am interested in deleting a blank row in a message. I know that if I
want to add a row I use the command VbCrLf, but is there one to delete
a row?

Any help/suggestions greatly appreciated.

Regards

Peder

RB Smissaert

Deleting a row in a message (opposite to VbCrLf)
 
Maybe you need to show your code, but perhaps something like this:

Dim strMsg as string

strMsg = "message" & vbcrlf & "with linebreak"

strMsg = Replace(strMsg, vbcrlf, vbnullstring)

Msgbox strMsg


RBS


"Wesslan" wrote in message
...
Hi,

I am interested in deleting a blank row in a message. I know that if I
want to add a row I use the command VbCrLf, but is there one to delete
a row?

Any help/suggestions greatly appreciated.

Regards

Peder



Wesslan

Deleting a row in a message (opposite to VbCrLf)
 
RB Smissaert,

Sorry I should have showed the code right away. You suggestion is a
good one, however in my case it will lead to that all my VbCrLf are
replaced with nothing. Hence I loose all my row breaks ;)

The code is:

Sub Top3Peers()
ttext = ""
SelectRow = 10

For i = 1 To 3

SPI = wbook1.Worksheets("Global - " & strSize & "
Cap").Range("N" & SelectRow).Value
SPI = Round(SPI)

' The company analysed is not to be part of peers
If Application.Proper$(wbook1.Worksheets(Sht).Range(" C" &
SelectRow).Value) = Company Then SelectRow = SelectRow + 1

ttext = ttext & Application.Proper$
(wbook1.Worksheets(Sht).Range("C" & SelectRow).Value) & " (SPI " & SPI
& ")"
ttext = ttext & vbCrLf
SelectRow = SelectRow + 1
Next i
oPPTApp.ActiveWindow.Selection.SlideRange.Shapes(R ectangle).Select

oPPTApp.ActiveWindow.Selection.ShapeRange.GroupIte ms(Index:=strIndex).TextFrame.TextRange.Characters (Start:=1,
Length:=250).Select
oPPTApp.ActiveWindow.Selection.TextRange.Text = ttext

End Sub

I am looping and for earch firm and result that is taken in, a new
line is created. However, when the loop finishes there will naturally
be one too many. Any suggestions?

Regards,
Peder

RB Smissaert

Deleting a row in a message (opposite to VbCrLf)
 
Simpy replace this:

ttext = ttext & vbCrLf

with this:

If i < 3 then
ttext = ttext & vbCrLf
end if


RBS

"Wesslan" wrote in message
...
RB Smissaert,

Sorry I should have showed the code right away. You suggestion is a
good one, however in my case it will lead to that all my VbCrLf are
replaced with nothing. Hence I loose all my row breaks ;)

The code is:

Sub Top3Peers()
ttext = ""
SelectRow = 10

For i = 1 To 3

SPI = wbook1.Worksheets("Global - " & strSize & "
Cap").Range("N" & SelectRow).Value
SPI = Round(SPI)

' The company analysed is not to be part of peers
If Application.Proper$(wbook1.Worksheets(Sht).Range(" C" &
SelectRow).Value) = Company Then SelectRow = SelectRow + 1

ttext = ttext & Application.Proper$
(wbook1.Worksheets(Sht).Range("C" & SelectRow).Value) & " (SPI " & SPI
& ")"
ttext = ttext & vbCrLf
SelectRow = SelectRow + 1
Next i
oPPTApp.ActiveWindow.Selection.SlideRange.Shapes(R ectangle).Select

oPPTApp.ActiveWindow.Selection.ShapeRange.GroupIte ms(Index:=strIndex).TextFrame.TextRange.Characters (Start:=1,
Length:=250).Select
oPPTApp.ActiveWindow.Selection.TextRange.Text = ttext

End Sub

I am looping and for earch firm and result that is taken in, a new
line is created. However, when the loop finishes there will naturally
be one too many. Any suggestions?

Regards,
Peder




All times are GMT +1. The time now is 10:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com