Need help on hide merge column

jamshoot

Board Regular
Joined
Oct 15, 2009
Messages
199
Hello
Need help to hide merge column and show all the column below the day merge. I've the following code but is only showing a single column.
Can someone help ......


Sub Hide()
Dim c As Range, rng
myday = Application.InputBox("Enter a Day", Title:="Hide Column")
If myday = False Then
Exit Sub
Else
If myday = "" Then
MsgBox ("No day input")
Exit Sub
End If
Continue:
Set rng = Range("e8:AZ8")
For Each c In rng
c.EntireColumn.Hidden = (UCase(CStr(c.Value)) <> UCase(myday))
Next c

Range("A1").Select
End If
End Sub

-------------------------
Below is my worksheet. I want to show all the column under the merge cell when i select the day. (i.e Date/Purpose/Time/Used By)


<table style="padding-right: 2pt; padding-left: 2pt; font-size: 10pt; font-family: Calibri,Arial; background-color: rgb(255, 255, 255);" border="1" cellpadding="0" cellspacing="0"> <colgroup> <col style="font-weight: bold; width: 30px;"> <col style="width: 27px;"> <col style="width: 51px;"> <col style="width: 31px;"> <col style="width: 51px;"> <col style="width: 31px;"> <col style="width: 51px;"> <col style="width: 31px;"> <col style="width: 51px;"> <col style="width: 31px;"> <col style="width: 51px;"> <col style="width: 31px;"> <col style="width: 51px;"> <col style="width: 31px;"> <col style="width: 51px;"> <col style="width: 31px;"> <col style="width: 51px;"> <col style="width: 31px;"> <col style="width: 51px;"> <col style="width: 31px;"> <col style="width: 51px;"> <col style="width: 31px;"> <col style="width: 51px;"> <col style="width: 31px;"> <col style="width: 51px;"></colgroup> <tbody> <tr style="font-weight: bold; font-size: 8pt; background-color: rgb(202, 202, 202); text-align: center;"> <td> </td> <td>B</td> <td>C</td> <td>D</td> <td>E</td> <td>F</td> <td>G</td> <td>H</td> <td>I</td> <td>J</td> <td>K</td> <td>L</td> <td>M</td> <td>N</td> <td>O</td> <td>P</td> <td>Q</td> <td>R</td> <td>S</td> <td>T</td> <td>U</td> <td>V</td> <td>W</td> <td>X</td> <td>Y</td></tr> <tr style="height: 17px;"> <td style="font-size: 8pt; background-color: rgb(202, 202, 202); text-align: center;">2</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td></tr> <tr style="height: 34px;"> <td style="font-size: 8pt; background-color: rgb(202, 202, 202); text-align: center;">3</td> <td style="font-weight: bold; font-size: 20pt; font-family: Arial Narrow; text-align: center;" colspan="4">Mon</td> <td style="font-weight: bold; font-size: 20pt; font-family: Arial Narrow; text-align: center;" colspan="4">Tue</td> <td style="font-weight: bold; font-size: 20pt; font-family: Arial Narrow; text-align: center;" colspan="4">Wed</td> <td style="font-weight: bold; font-size: 20pt; font-family: Arial Narrow; text-align: center;" colspan="4">Thu</td> <td style="font-weight: bold; font-size: 20pt; font-family: Arial Narrow; text-align: center;" colspan="4">Fri</td> <td style="font-weight: bold; font-size: 20pt; font-family: Arial Narrow; text-align: center;" colspan="4">Sat</td></tr> <tr style="height: 17px;"> <td style="font-size: 8pt; background-color: rgb(202, 202, 202); text-align: center;">4</td> <td style="font-weight: bold; font-size: 8pt; font-family: Arial Narrow; text-align: center;">Date</td> <td style="font-weight: bold; font-family: Arial Narrow; text-align: center;">Purpose</td> <td style="font-weight: bold; font-family: Arial Narrow; text-align: center;">Time</td> <td style="font-weight: bold; font-family: Arial Narrow; text-align: center;">Used By</td> <td style="font-weight: bold; font-family: Arial Narrow; text-align: center;">Date</td> <td style="font-weight: bold; font-family: Arial Narrow; text-align: center;">Purpose</td> <td style="font-weight: bold; font-family: Arial Narrow; text-align: center;">Time</td> <td style="font-weight: bold; font-family: Arial Narrow; text-align: center;">Used By</td> <td style="font-weight: bold; font-family: Arial Narrow; text-align: center;">Date</td> <td style="font-weight: bold; font-family: Arial Narrow; text-align: center;">Purpose</td> <td style="font-weight: bold; font-family: Arial Narrow; text-align: center;">Time</td> <td style="font-weight: bold; font-family: Arial Narrow; text-align: center;">Used By</td> <td style="font-weight: bold; font-family: Arial Narrow; text-align: center;">Date</td> <td style="font-weight: bold; font-family: Arial Narrow; text-align: center;">Purpose</td> <td style="font-weight: bold; font-family: Arial Narrow; text-align: center;">Time</td> <td style="font-weight: bold; font-family: Arial Narrow; text-align: center;">Used By</td> <td style="font-weight: bold; font-family: Arial Narrow; text-align: center;">Date</td> <td style="font-weight: bold; font-family: Arial Narrow; text-align: center;">Purpose</td> <td style="font-weight: bold; font-family: Arial Narrow; text-align: center;">Time</td> <td style="font-weight: bold; font-family: Arial Narrow; text-align: center;">Used By</td> <td style="font-weight: bold; font-family: Arial Narrow; text-align: center;">Date</td> <td style="font-weight: bold; font-family: Arial Narrow; text-align: center;">Purpose</td> <td style="font-weight: bold; font-family: Arial Narrow; text-align: center;">Time</td> <td style="font-weight: bold; font-family: Arial Narrow; text-align: center;">Used By</td></tr> <tr style="height: 17px;"> <td style="font-size: 8pt; background-color: rgb(202, 202, 202); text-align: center;">5</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td></tr> <tr style="height: 17px;"> <td style="font-size: 8pt; background-color: rgb(202, 202, 202); text-align: center;">6</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td></tr> <tr style="height: 17px;"> <td style="font-size: 8pt; background-color: rgb(202, 202, 202); text-align: center;">7</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td></tr> <tr style="height: 17px;"> <td style="font-size: 8pt; background-color: rgb(202, 202, 202); text-align: center;">8</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td></tr> <tr style="height: 17px;"> <td style="font-size: 8pt; background-color: rgb(202, 202, 202); text-align: center;">9</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td></tr> <tr style="height: 17px;"> <td style="font-size: 8pt; background-color: rgb(202, 202, 202); text-align: center;">10</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td></tr></tbody></table>

Cheers
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Forum statistics

Threads
1,224,583
Messages
6,179,681
Members
452,937
Latest member
Bhg1984

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top