PC Review


Reply
Thread Tools Rate Thread

AutoFit Looks Terrible

 
 
=?Utf-8?B?R3JhbmRNYU1h?=
Guest
Posts: n/a
 
      19th Jul 2007
On the code below I create a New WorkBook. Everything works great excepr
that when I display my new WorkBook the Rows acn be anywhere from 3/8" to 2"
in height.

I use the .ColumnWidth = 111 line to get by my Blank (Null) Cells. I think
this is where my problem is, but I am not real sure. The 111 comes from the
fact that it is the largest number of characters that can be in any one cell
on the Application.


Sub ClassIntl()

Dim wkst As Worksheet ' Current Sheet
Dim lbls As Workbook
Dim wslb As Worksheet ' Work Sheet
Dim rng As Range
Dim lastRow As Long
Dim SelCol As String
Dim ColNum As Long
Dim HSClass As Long

Set wkst = ActiveSheet
HSClass = 12

SelCol = InputBox("Enter the Column for the registrar You Want
to Send Scores to:!")
ColNum = Columns(SelCol & ":" & SelCol).Column
SelCol = "A1," & SelCol & "1"

Set lbls = Workbooks.Add(1)
Set wslb = lbls.Worksheets(1)
lbls.Title = "Letters to Universities"
lbls.Subject = "IntlTest"

With wkst
If .AutoFilterMode Then .AutoFilterMode = False
Set rng = .Range("A1").CurrentRegion
With rng
.AutoFilter Field:=HSClass, Criteria1:="AAA"
.AutoFilter Field:=ColNum, Criteria1:="<>"
.Columns(ColNum).Copy wslb.Columns(1).Cells(1)
.Columns(2).Copy wslb.Columns(2).Cells(1)
.Columns(5).Copy wslb.Columns(3).Cells(1)
.Columns(7).Copy wslb.Columns(4).Cells(1)
End With
End With

With wslb.Range("A:F").EntireColumn
.ColumnWidth = 111
.AutoFit
End With

If wkst.AutoFilterMode Then wkst.AutoFilterMode = False

ActiveSheet.PrintPreview

wslb.SaveAs Filename:="C:\ExcelExp\JustNE.xls",
FileFormat:=xlNormal

End Sub

Any assistance in helping me make this new Book a little more representable
will be appreciated.

Thanks in Advance

Granny
 
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
Rows().AutoFit starts a calculation, but Columns().AutoFit doesn't Stefano Microsoft Excel Programming 1 30th Nov 2009 05:01 PM
RE: Rows().AutoFit starts a calculation, but Columns().AutoFit doesn't Mike H Microsoft Excel Programming 0 25th Nov 2009 04:31 PM
RE: Autofit (Columns.EntireColumn.AutoFit) does not work Kevin B Microsoft Excel Misc 0 10th Feb 2009 05:21 PM
RE: Autofit (Columns.EntireColumn.AutoFit) does not work Kevin B Microsoft Excel Misc 0 10th Feb 2009 05:14 PM
Thats terrible DL Windows Vista Mail 0 7th Feb 2009 10:15 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:48 AM.