SimonHughes
Well-known Member
- Joined
- Sep 16, 2009
- Messages
- 507
- Office Version
- 365
- Platform
- Windows
Hello,
I am using Excel 2010.
I have created a Macro but now need to add to it but am just not sure how to go about it. The first macro is:
Sub CP_First()
'
' CP_First Macro
'
'
Selection.EntireRow.Delete
Selection.EntireRow.Delete
Selection.EntireRow.Delete
Selection.EntireRow.Delete
Cells.Select
With Selection
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("A1:Q1").Select
Selection.ColumnWidth = 75
Cells.Select
Cells.EntireRow.AutoFit
Cells.EntireColumn.AutoFit
Range("C3").Select
Selection.EntireColumn.Delete
Range("E3").Select
Selection.EntireColumn.Delete
Range("N3").Select
Selection.EntireColumn.Delete
Rows("1:1").Select
Range("D1").Activate
Selection.ClearFormats
Range("F4").Select
Selection.EntireColumn.Insert
Selection.EntireColumn.Insert
Cells.Select
Range("D1").Activate
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
With Selection.Font
.Name = "Calibri"
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With
Range("H4").Select
End Sub
And I need to add the following onto it
Sub TextToColumn()
'
' TextToColumn Macro
'
'
Columns("E:E").Select
Selection.TextToColumns Destination:=Range("F1"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(1, 1)), TrailingMinusNumbers:=True
Range("F1").Select
ActiveCell.FormulaR1C1 = "CC"
Range("G1").Select
ActiveCell.FormulaR1C1 = "MS"
Range("G2").Select
End Sub
I suppose copy paste but doi not want to mess it up, your help appreciated
I am using Excel 2010.
I have created a Macro but now need to add to it but am just not sure how to go about it. The first macro is:
Sub CP_First()
'
' CP_First Macro
'
'
Selection.EntireRow.Delete
Selection.EntireRow.Delete
Selection.EntireRow.Delete
Selection.EntireRow.Delete
Cells.Select
With Selection
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("A1:Q1").Select
Selection.ColumnWidth = 75
Cells.Select
Cells.EntireRow.AutoFit
Cells.EntireColumn.AutoFit
Range("C3").Select
Selection.EntireColumn.Delete
Range("E3").Select
Selection.EntireColumn.Delete
Range("N3").Select
Selection.EntireColumn.Delete
Rows("1:1").Select
Range("D1").Activate
Selection.ClearFormats
Range("F4").Select
Selection.EntireColumn.Insert
Selection.EntireColumn.Insert
Cells.Select
Range("D1").Activate
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
With Selection.Font
.Name = "Calibri"
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With
Range("H4").Select
End Sub
And I need to add the following onto it
Sub TextToColumn()
'
' TextToColumn Macro
'
'
Columns("E:E").Select
Selection.TextToColumns Destination:=Range("F1"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(1, 1)), TrailingMinusNumbers:=True
Range("F1").Select
ActiveCell.FormulaR1C1 = "CC"
Range("G1").Select
ActiveCell.FormulaR1C1 = "MS"
Range("G2").Select
End Sub
I suppose copy paste but doi not want to mess it up, your help appreciated