Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
HIDING CELLS AND COLUMNS
I have a spreadsheet with three columns A, B, and C. If there is no
value in column A, then I want columns B AND C hidden. Conversley, if a cell in column A is not blank, then do not hide columns B and C. If or when any cell in column A does have a value typed into it, then columns B and C are, or become, unhidden. ALSO, I have three columns in another spreadsheet, again A, B, and C. If the cell in column A1 is blank, I would like the cells in column B1 and C1 to say N/A, or maybe be shaded grey, I havent decided yet. If cell A1 is not blank, then dont do anything or change B1 and C1. If or when A1 does have a value typed in it, then B1 and C1 revert to normal, allowing values will be typed in by the user. Any specific help for someone who is not very well versed in visual basic? And, if so, where would you go about attaching the code? Thanks alot, chris M |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
HIDING CELLS AND COLUMNS
YOu can't have B and C hidden in one row and unhidden in the next. Try this:
Sub testing() Dim myRange As Range Dim r As Range Dim myrange2 Dim myhiddenrange As Range Set myRange = ActiveSheet.Range("A1:A10") For Each r In myRange Set myhiddenrange = r.Offset(0, 1).Resize(1, 2) If IsEmpty(r) Then myhiddenrange.Font.ColorIndex = 1 Else myhiddenrange.Font.ColorIndex = 2 End If Next r End Sub "chris morr" wrote: I have a spreadsheet with three columns A, B, and C. If there is no value in column A, then I want columns B AND C hidden. Conversley, if a cell in column A is not blank, then do not hide columns B and C. If or when any cell in column A does have a value typed into it, then columns B and C are, or become, unhidden. ALSO, I have three columns in another spreadsheet, again A, B, and C. If the cell in column A1 is blank, I would like the cells in column B1 and C1 to say N/A, or maybe be shaded grey, I havent decided yet. If cell A1 is not blank, then dont do anything or change B1 and C1. If or when A1 does have a value typed in it, then B1 and C1 revert to normal, allowing values will be typed in by the user. Any specific help for someone who is not very well versed in visual basic? And, if so, where would you go about attaching the code? Thanks alot, chris M |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Hiding Columns | Excel Discussion (Misc queries) | |||
Help with hiding columns | Excel Programming | |||
Hiding columns | Excel Discussion (Misc queries) | |||
Hiding Columns | Excel Programming | |||
Hiding columns in VB | Excel Programming |