View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default columns seletion error

Hi Mark
some ideas:
- the .select is not required.
- why are you using a function. This won't work as functions can not
change the width of cells - use a sub

try the following
Public Sub PayRollSheetFormat()
'Application.Run CleanSheetFormat()
ActiveWindow.FreezePanes = False
Columns("S").ColumnWidth = 10
Columns("T").ColumnWidth = 25
End Sub

Frank

Try the following:
Public Function PayRollSheetFormat()
'Application.Run CleanSheetFormat()
ActiveWindow.FreezePanes = False
Columns("S:S").Select
Selection.ColumnWidth = 10
Columns("T:T").Select
Selection.ColumnWidth = 25
End Function



mark kubicki wrote:
i have this code entered:

Public Function PayRollSheetFormat()
'Application.Run CleanSheetFormat()
ActiveWindow.FreezePanes = False
Columns("S:S").Select
Selection.ColumnWidth = 10
Columns("T:T").Select
Selection.ColumnWidth = 25
End Function

selecting column S or T selects multiple columns (usually 4: R,S,T,U
or S,T,U,V respectively)

any hints about what might be causing the error?

mark