ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Fomatting based on columns displayed (https://www.excelbanter.com/excel-programming/362292-fomatting-based-columns-displayed.html)

rudy

Fomatting based on columns displayed
 

I am just getting into VBA so excuse me for my total lack of knowldege.
The problem I am having is with formatting. I have a report built with
borders, shading, etc. The report is $'s and units by month. It looks
great but I have been asked to put in views that show just $'s or just
units for the month. This screws up my formatting. Can I have code
that applies borders based on whether or not certain columns are
displayed???

Thanks.


--
rudy
------------------------------------------------------------------------
rudy's Profile: http://www.excelforum.com/member.php...o&userid=33911
View this thread: http://www.excelforum.com/showthread...hreadid=545067


Ivan Raiminius

Fomatting based on columns displayed
 
Hi Rudy,

you can use simple custom function:

Function ColumnVisible(Target As Range) as boolean
ColumnVisible = Not Target.cells(1,1).Columns.Hidden
End Function

And conditional formatting with formula =columnvisible(a1) with
appropriate formating for visible and hidden column.

Let me know if you need more help.

Regards,
Ivan


rudy

Fomatting based on columns displayed
 

I will give it a try and let you know. Thanks for the help. This site
is very helpful.


--
rudy
------------------------------------------------------------------------
rudy's Profile: http://www.excelforum.com/member.php...o&userid=33911
View this thread: http://www.excelforum.com/showthread...hreadid=545067


rudy

Fomatting based on columns displayed
 

Ivan,

Sorry but I am a rookie.... do I need to insert that piece of code
into a module and then apply the conditional formatting to tha
appropriate cells in the worksheet??

Thanks.


--
rudy
------------------------------------------------------------------------
rudy's Profile: http://www.excelforum.com/member.php...o&userid=33911
View this thread: http://www.excelforum.com/showthread...hreadid=545067


Ivan Raiminius

Fomatting based on columns displayed
 
Hi Rudy,

exactly.

Let me know if you have any problems with it.

Regards,
Ivan


rudy

Fomatting based on columns displayed
 

Thanks! Ivan:)


--
rudy
------------------------------------------------------------------------
rudy's Profile: http://www.excelforum.com/member.php...o&userid=33911
View this thread: http://www.excelforum.com/showthread...hreadid=545067



All times are GMT +1. The time now is 04:20 AM.

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