LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autofit Pivot column by Criteria


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


--
VBA Noob
------------------------------------------------------------------------
VBA Noob's Profile: http://www.excelforum.com/member.php...o&userid=33833
View this thread: http://www.excelforum.com/showthread...hreadid=536587

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Column Autofit mcolson Excel Discussion (Misc queries) 2 March 6th 08 10:19 PM
how to autofit column widths brew2u New Users to Excel 1 October 31st 07 11:21 AM
Autofit doesn't work when column not enough width Alex St-Pierre Excel Programming 3 April 19th 06 07:35 PM
autofit columns in pivot table Pastel Hughes Excel Discussion (Misc queries) 2 January 5th 06 10:27 PM
Column Autofit Problem Graham Haughs Excel Programming 7 August 9th 04 02:25 PM


All times are GMT +1. The time now is 10:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"