V
VBA Noob
Hi all,
I'm looking to see if I can do a search on a pivot table for the word
"Total" which is in row 4 and then adjust the column width for each
cell it finds to 2.5
I've recorded the below which works if you use ctrl A to select all but
when i run the macro it changes all the column widths to 2.5
Any thoughts ??
VBA:
Sub Autofit()
Cells.EntireColumn.Autofit
Rows("4:4").Select
Selection.Find(What:="total", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Selection.ColumnWidth = 2.5
End Sub
Thanks in advance
VBA Noob
I'm looking to see if I can do a search on a pivot table for the word
"Total" which is in row 4 and then adjust the column width for each
cell it finds to 2.5
I've recorded the below which works if you use ctrl A to select all but
when i run the macro it changes all the column widths to 2.5
Any thoughts ??
VBA:
Sub Autofit()
Cells.EntireColumn.Autofit
Rows("4:4").Select
Selection.Find(What:="total", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Selection.ColumnWidth = 2.5
End Sub
Thanks in advance
VBA Noob