PC Review


Reply
Thread Tools Rate Thread

auto fit & horizontal alignment not working

 
 
petedacook
Guest
Posts: n/a
 
      29th Jul 2009
I have some code that is not centering and formatting all of the columns. I
have coppied the snippet of code that his adjusting the alignment and
autofit. Can anyone tell why the code is not formatting all of the cells?

Columns("A:R").EntireColumn.Select
With Selection.EntireColumn
Cells.EntireColumn.AutoFit
HorizontalAlignment = xlCenter
VerticalAlignment = xlBottom
End With




Thanks!!
 
Reply With Quote
 
 
 
 
Gary Keramidas
Guest
Posts: n/a
 
      29th Jul 2009
here's how i'd do it:

Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
With ws.Columns("A:R")
.AutoFit
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
End With

--

Gary Keramidas
Excel 2003


"petedacook" <(E-Mail Removed)> wrote in message
news:2E540719-2F5E-41C9-8E32-(E-Mail Removed)...
>I have some code that is not centering and formatting all of the columns.
>I
> have coppied the snippet of code that his adjusting the alignment and
> autofit. Can anyone tell why the code is not formatting all of the cells?
>
> Columns("A:R").EntireColumn.Select
> With Selection.EntireColumn
> Cells.EntireColumn.AutoFit
> HorizontalAlignment = xlCenter
> VerticalAlignment = xlBottom
> End With
>
>
>
>
> Thanks!!


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Horizontal Alignment Philippe Perrault Microsoft Excel Programming 0 23rd Dec 2008 07:27 PM
what is apply justify horizontal alignment? =?Utf-8?B?emhlbg==?= Microsoft Word New Users 2 22nd Feb 2006 10:27 PM
Horizontal Alignment in DataGrid Mike Microsoft Dot NET Compact Framework 1 6th Aug 2004 12:35 AM
horizontal alignment in datagrid Kenny Microsoft Dot NET 0 9th Apr 2004 08:20 AM
fp 2002 - horizontal alignment ??? Pam Microsoft Frontpage 2 9th Oct 2003 08:46 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:33 PM.