ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide non-contiguous columns (https://www.excelbanter.com/excel-programming/361917-hide-non-contiguous-columns.html)

BEEJAY

Hide non-contiguous columns
 
Greetings:
Have for some time used the following in a number of applications
Columns("F:G").Select
Selection.EntireColumn.Hidden = True
Works Great:
Now I need to add column J, as well.
After checking group sites, I tried:
Columns("F:G,J").Select
Columns("F:G,J:K").Select
etc................. .
F and G always hides fine
J (and K) are to stubborn to disappear.

Then I read in one post to use "Select" as little as possible, so I changed to
Range("F:G,J:K").EntireColumn.Hidden = True
and variations thereof.
Again, F and G disappear, J and K just keep hanging around.

Once again, I'm likely missing something obviouis, but I just can't find it.
Please help.

ALSO: Why is it recommended to be good coding practice to use SELECT as
infrequently as possible?

Thanks


Bob Phillips[_6_]

Hide non-contiguous columns
 
No need to select

Range("F:G,J:L").EntireColumn.Hidden = False


--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"BEEJAY" wrote in message
...
Greetings:
Have for some time used the following in a number of applications
Columns("F:G").Select
Selection.EntireColumn.Hidden = True
Works Great:
Now I need to add column J, as well.
After checking group sites, I tried:
Columns("F:G,J").Select
Columns("F:G,J:K").Select
etc................. .
F and G always hides fine
J (and K) are to stubborn to disappear.

Then I read in one post to use "Select" as little as possible, so I

changed to
Range("F:G,J:K").EntireColumn.Hidden = True
and variations thereof.
Again, F and G disappear, J and K just keep hanging around.

Once again, I'm likely missing something obviouis, but I just can't find

it.
Please help.

ALSO: Why is it recommended to be good coding practice to use SELECT as
infrequently as possible?

Thanks




BEEJAY

Hide non-contiguous columns
 
Thanks, Bob.


"Bob Phillips" wrote:

No need to select

Range("F:G,J:L").EntireColumn.Hidden = False


--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"BEEJAY" wrote in message
...
Greetings:
Have for some time used the following in a number of applications
Columns("F:G").Select
Selection.EntireColumn.Hidden = True
Works Great:
Now I need to add column J, as well.
After checking group sites, I tried:
Columns("F:G,J").Select
Columns("F:G,J:K").Select
etc................. .
F and G always hides fine
J (and K) are to stubborn to disappear.

Then I read in one post to use "Select" as little as possible, so I

changed to
Range("F:G,J:K").EntireColumn.Hidden = True
and variations thereof.
Again, F and G disappear, J and K just keep hanging around.

Once again, I'm likely missing something obviouis, but I just can't find

it.
Please help.

ALSO: Why is it recommended to be good coding practice to use SELECT as
infrequently as possible?

Thanks






All times are GMT +1. The time now is 07:41 PM.

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