Sharid
Well-known Member
- Joined
- Apr 22, 2007
- Messages
- 1,064
- Office Version
- 2016
- Platform
- Windows
I can not set the column width for column A in the new sheet, and I can not work out why. The rest of the code is fine. I have posted the whole code below. The issue is only with 1 line.
Problem with this, rest of the code works
Full Code
Thanks
Problem with this, rest of the code works
VBA Code:
Worksheets("Keywords Search").Column("A").ColumnWidth = 100
Full Code
VBA Code:
' Keyword sheet2 create a copy of the sheet
Application.SheetsInNewWorkbook = 1
Workbooks.Add
With ThisWorkbook
.Sheets("Sheet2").UsedRange.Copy 'Copy this sheet
ActiveWorkbook.Sheets(1).Range("A1").PasteSpecial xlPasteValues
ActiveWorkbook.Sheets(1).Name = "Keywords Search" ' new sheet name
On Error Resume Next
[B]'' ######################## THIS BIT IS NOT WORKING ###################[/B]
'ColumnWidths
Worksheets("Keywords Search").Column("A").ColumnWidth = 100
'[B]' ######################## THIS BIT IS NOT WORKING ###################[/B]
'Worksheets("Keywords Url Search").Columns("A:B").ColumnWidth = 700
'Worksheets("Keywords Url Search").Columns("B:K").AutoFit
'Worksheets("Sheet2").Columns("L:Q").ColumnWidth = 30 ' ADDRESS
'Formatting the header
Range("A1").Font.Name = "Calibri"
Range("A1").HorizontalAlignment = xlCenter
Range("A1").Font.Color = vbWhite
Range("A1:z1").Interior.ColorIndex = 16 '''''.Color = vbGreen
'Name of Sheet
ActiveWorkbook.SaveAs "Keyword Search" & Format(Now, " dd_mm_yyyy HH_mm_ss") & ".xlsx"
On Error Resume Next
'Freeze panel on new sheet
Dim ws As Worksheet
For Each ws In Worksheets
ws.Activate
With Application.ActiveWindow
.SplitColumn = 0
.SplitRow = 1
End With
Application.ActiveWindow.FreezePanes = True
If Not ActiveSheet.AutoFilterMode Then
ActiveSheet.Range("A1").AutoFilter
End If
Next ws
End With
Thanks