Trevor3007
Well-known Member
- Joined
- Jan 26, 2017
- Messages
- 667
- Office Version
- 365
- Platform
- Windows
Hi,
I use the following:-
Is it posible so that individual columns can go to their retrospective size for the data in the applicable cell & 'wrap' text too?
MTIA & stay safe
Trevor3007
I use the following:-
VBA Code:
Sub sortNformat()
'
' sortNformat Macro
'
'
Range("A1:C20").Select
Selection.Font.Size = 12
Selection.Font.Size = 14
Selection.Font.Size = 16
Selection.Font.Size = 18
Selection.Font.Size = 20
Selection.Font.Size = 22
Range("A2").Select
Columns("C:C").EntireColumn.AutoFit
Range("A1:C16").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Range("B12").Select
Columns("A:A").EntireColumn.AutoFit
Columns("B:B").Select
With Selection
.HorizontalAlignment = xlGeneral
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("A1").Select
ActiveWorkbook.Worksheets("Sheet1").AutoFilter.sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").AutoFilter.sort.SortFields.Add2 Key:= _
Range("A1"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").AutoFilter.sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Columns("B:B").EntireColumn.AutoFit
Selection.ColumnWidth = 93.43
Range("A3").Select
End Sub
Is it posible so that individual columns can go to their retrospective size for the data in the applicable cell & 'wrap' text too?
MTIA & stay safe
Trevor3007