Stormseed
Banned
- Joined
- Sep 18, 2006
- Messages
- 3,274
Any help is much appreciated !!
I have this code which delimits the text in the first column with a delimiter...and collates the columns together again. The resultant column after the delimit is on the extreme left of the range. Neverthless - I need to delete three columns to the right of the resultant column (i.e, column B,C & D) and put the cursor focus again to A1 or select A1.
Please help me with the correct code.
Sub Product_Report_Macro()
Cells.Select
Cells.EntireColumn.AutoFit
Range("A3").Select
Columns("A:A").ColumnWidth = 11.5
Rows("1:4").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
Columns("B:B").Select
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="[", FieldInfo:=Array(Array(1, 1), Array(2, 1))
Columns("A:A").EntireColumn.AutoFit
Columns("B:B").Select
Selection.TextToColumns Destination:=Range("B1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="]", FieldInfo:=Array(Array(1, 1), Array(2, 1))
Columns("A:A").Select
Selection.Delete Shift:=xlToLeft
Columns("B:H").Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
ActiveCell.FormulaR1C1 = "Code"
Columns("A:A").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.MergeCells = False
End With
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Font.Bold = True
Selection.End(xlToLeft).Select
Cells.Select
Cells.EntireColumn.AutoFit
Range("A1").Select
End Sub
I have this code which delimits the text in the first column with a delimiter...and collates the columns together again. The resultant column after the delimit is on the extreme left of the range. Neverthless - I need to delete three columns to the right of the resultant column (i.e, column B,C & D) and put the cursor focus again to A1 or select A1.
Please help me with the correct code.
Sub Product_Report_Macro()
Cells.Select
Cells.EntireColumn.AutoFit
Range("A3").Select
Columns("A:A").ColumnWidth = 11.5
Rows("1:4").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
Columns("B:B").Select
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="[", FieldInfo:=Array(Array(1, 1), Array(2, 1))
Columns("A:A").EntireColumn.AutoFit
Columns("B:B").Select
Selection.TextToColumns Destination:=Range("B1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="]", FieldInfo:=Array(Array(1, 1), Array(2, 1))
Columns("A:A").Select
Selection.Delete Shift:=xlToLeft
Columns("B:H").Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
ActiveCell.FormulaR1C1 = "Code"
Columns("A:A").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.MergeCells = False
End With
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Font.Bold = True
Selection.End(xlToLeft).Select
Cells.Select
Cells.EntireColumn.AutoFit
Range("A1").Select
End Sub