columns seletion error

  • Thread starter Thread starter mark kubicki
  • Start date Start date
M

mark kubicki

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
 
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:
 
Back
Top