ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Columns AV:BE Showing (Not Suppose To) (https://www.excelbanter.com/excel-programming/388833-columns-av-showing-not-suppose.html)

chinny

Columns AV:BE Showing (Not Suppose To)
 
Morning Guys,

The script below hides selected columns however columns AV:BE are hiding but
they are also including column AU and BF. Columns AU and BF are not supposed
to hide. Please see below.

If Range("B44") = Range("BD15") Then
Range("E:L,N:W, AB:AD,AK:AR,AV:BE").Select
Selection.EntireColumn.Hidden = True
Range("A45").Value = "After Hours Working"
Else

Would there be a problems in the script above?

Cheers

Dave Peterson

Columns AV:BE Showing (Not Suppose To)
 
The code looks ok to me.

But if AU and BF are hidden to start, they'll be hidden at the end, too.

If that's not it, do you have any merged cells that include cells from column AU
and BF and cells in a column being hidden?

chinny wrote:

Morning Guys,

The script below hides selected columns however columns AV:BE are hiding but
they are also including column AU and BF. Columns AU and BF are not supposed
to hide. Please see below.

If Range("B44") = Range("BD15") Then
Range("E:L,N:W, AB:AD,AK:AR,AV:BE").Select
Selection.EntireColumn.Hidden = True
Range("A45").Value = "After Hours Working"
Else

Would there be a problems in the script above?

Cheers


--

Dave Peterson

Barb Reinhardt

Columns AV:BE Showing (Not Suppose To)
 
It's not being hidden in that snippet of code. Try stepping through it to
see if you can find where it's happening.

HTH,
Barb Reinhardt

"chinny" wrote:

Morning Guys,

The script below hides selected columns however columns AV:BE are hiding but
they are also including column AU and BF. Columns AU and BF are not supposed
to hide. Please see below.

If Range("B44") = Range("BD15") Then
Range("E:L,N:W, AB:AD,AK:AR,AV:BE").Select
Selection.EntireColumn.Hidden = True
Range("A45").Value = "After Hours Working"
Else

Would there be a problems in the script above?

Cheers


chinny

Columns AV:BE Showing (Not Suppose To)
 
Morning Dave,

Cheers for the advice. Yes there is a merge field which is affecting it.
I've taken that into account now and it works perfectly fine. Thanks for your
help.

"Dave Peterson" wrote:

The code looks ok to me.

But if AU and BF are hidden to start, they'll be hidden at the end, too.

If that's not it, do you have any merged cells that include cells from column AU
and BF and cells in a column being hidden?

chinny wrote:

Morning Guys,

The script below hides selected columns however columns AV:BE are hiding but
they are also including column AU and BF. Columns AU and BF are not supposed
to hide. Please see below.

If Range("B44") = Range("BD15") Then
Range("E:L,N:W, AB:AD,AK:AR,AV:BE").Select
Selection.EntireColumn.Hidden = True
Range("A45").Value = "After Hours Working"
Else

Would there be a problems in the script above?

Cheers


--

Dave Peterson



All times are GMT +1. The time now is 01:45 AM.

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