ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   problem selecting entire column (https://www.excelbanter.com/excel-programming/292596-problem-selecting-entire-column.html)

Mark Kubicki

problem selecting entire column
 
once again, i'm having a problem selecting an entire column(s):
the following code consistently selects more columns than i want:


Columns("E:R").Select
With Selection
.columnwidth = 10.25
.EntireColumn.Hidden = False
End With
Columns("S:T").Select
With Selection
.EntireColumn.Hidden = True
End With
Columns("U:U").Select
With Selection
.columnwidth = 13
End With

as always, thanks in advance
mark



Ken Wright

problem selecting entire column
 
No need to select at all:-

Sub Cols()

With Columns("E:R")
.ColumnWidth = 10.25
.EntireColumn.Hidden = False
End With

With Columns("S:T")
.EntireColumn.Hidden = True
End With

With Columns("U:U")
.ColumnWidth = 13
End With

End Sub

or

Sub Cols()

With Columns("E:R")
.ColumnWidth = 10.25
.EntireColumn.Hidden = False
End With

Columns("S:T").EntireColumn.Hidden = True
Columns("U:U").ColumnWidth = 13

End Sub

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------



"mark kubicki" wrote in message
...
once again, i'm having a problem selecting an entire column(s):
the following code consistently selects more columns than i want:


Columns("E:R").Select
With Selection
.columnwidth = 10.25
.EntireColumn.Hidden = False
End With
Columns("S:T").Select
With Selection
.EntireColumn.Hidden = True
End With
Columns("U:U").Select
With Selection
.columnwidth = 13
End With

as always, thanks in advance
mark




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.594 / Virus Database: 377 - Release Date: 24/02/2004




All times are GMT +1. The time now is 03:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com