Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
How can I set up my excel sheet so that if the user enters 'yes' next to a
question, then 2 extra columns are shown? Thanks. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
You'll need a macro to do the work. Maybe you could use a worksheet_change
event that looks for changes that the user types in. Then reacts and does something. If you want to try: rightclick on the worksheet tab that should have this behavior. Select view code and paste this into that new code window. Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) Dim myRngToCheck As Range Dim myCell As Range Set myRngToCheck = Me.Range("c3, f3, k3") If Intersect(Target, myRngToCheck) Is Nothing Then Exit Sub On Error Resume Next 'just skip any errors Application.EnableEvents = False For Each myCell In myRngToCheck.Cells myCell.Offset(0, 1).Resize(1, 2).EntireColumn.Hidden _ = CBool(LCase(myCell.Value) = "yes") Next myCell Application.EnableEvents = True On Error GoTo 0 End Sub I unhid the two columns just to the right of the cell that changed. mgirving wrote: How can I set up my excel sheet so that if the user enters 'yes' next to a question, then 2 extra columns are shown? Thanks. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
adding extra digits to columns | Excel Discussion (Misc queries) | |||
adding extra digits to columns | Excel Discussion (Misc queries) | |||
Extra Columns | Excel Discussion (Misc queries) | |||
formula to show ranges in columns | Excel Worksheet Functions | |||
add a column to a pivot table that would show the difference between 2 other Columns | Excel Worksheet Functions |