TurboDieselOne
Board Regular
- Joined
- Oct 29, 2008
- Messages
- 52
Hi
Sub removeFirstLine()
Application.ScreenUpdating = False
Dim selectedCell As Range
Dim arrSplit As Variant
On Error Resume Next
For Each selectedCell In Selection.Cells
arrSplit = Split(selectedCell.Value, Chr(10))
selectedCell = arrSplit(1)
Next
Application.ScreenUpdating = True
End Sub
I need to adapt this to remove more than 1 Line but not the last line.
The Lines are added using A context Menu which inserts a Name and VbCRLF char after selection a name.
Works great but I cannot seem to get it to remove more than 1 vbCrlf
The Code that adds the Line is:-
Sub OtherJointerMacro()
' This module will & Add a Gangs name to the Job
Dim MyCell As Range
On Error Resume Next
For Each MyCell In Selection.Cells
MyCell.Value = "OTHER JOINTER" & vbCrLf & MyCell.Value
Next
'With ActiveCell.Characters(Start:=1, length:=13).Font
'.Name = "Arial"
'.FontStyle = "Bold"
'End With
On Error GoTo 0
End Sub
The Bold Section was an idea that worked but when removing the line made the all the cell bold which was not good but the first line bold was good.
Any Remedies would be well appreciated
Thanks
Sub removeFirstLine()
Application.ScreenUpdating = False
Dim selectedCell As Range
Dim arrSplit As Variant
On Error Resume Next
For Each selectedCell In Selection.Cells
arrSplit = Split(selectedCell.Value, Chr(10))
selectedCell = arrSplit(1)
Next
Application.ScreenUpdating = True
End Sub
I need to adapt this to remove more than 1 Line but not the last line.
The Lines are added using A context Menu which inserts a Name and VbCRLF char after selection a name.
Works great but I cannot seem to get it to remove more than 1 vbCrlf
The Code that adds the Line is:-
Sub OtherJointerMacro()
' This module will & Add a Gangs name to the Job
Dim MyCell As Range
On Error Resume Next
For Each MyCell In Selection.Cells
MyCell.Value = "OTHER JOINTER" & vbCrLf & MyCell.Value
Next
'With ActiveCell.Characters(Start:=1, length:=13).Font
'.Name = "Arial"
'.FontStyle = "Bold"
'End With
On Error GoTo 0
End Sub
The Bold Section was an idea that worked but when removing the line made the all the cell bold which was not good but the first line bold was good.
Any Remedies would be well appreciated
Thanks