Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Macro to Hide/Show Columns based on control cell value

This should be simple, but I am totally stumped.

I have a series of columns where each column represents a project. I would
like to have only one column display at a time as determined by a drop box
selection where the last entry is "All" and all of the projects are show
when that is selected.

I recorded a macro to hide all of the columns, and then unhide the one that
is selected, or unhide all if the user selects all.

Columns("D:K").Select
Selection.EntireColumn.Hidden = True
Columns("E:E").Select
Selection.EntireColumn.Hidden = False

The drop box list and return cell is on a hidden sheet where I have a named
range that will calculate to the actual column(s) to be unhidden e.g., E:E.

How do I get the macro to use the value in the worksheet (the worksheet is
named "Controls" and the cell is named "shown" and is at C1. The project
list is on a sheet named "Notebook".

I may as well ask, what is the equivalent of "echo off" where the actions
are not shown while the macro is running?

It seems to be the declaring the variable and using it in the select command
that I am having trouble with.

I appreciate your help.

Steve


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Macro to Hide/Show Columns based on control cell value

Sheets("Controls").Range("Shown"
Sheets("Controls").ComboBox1.Tex
Sheets("NoteBook").Columns("D:K"
Application.ScreenUpdating = Fals
Application.ScreenUpdating = True

----- Steve N wrote: ----

This should be simple, but I am totally stumped

I have a series of columns where each column represents a project. I woul
like to have only one column display at a time as determined by a drop bo
selection where the last entry is "All" and all of the projects are sho
when that is selected

I recorded a macro to hide all of the columns, and then unhide the one tha
is selected, or unhide all if the user selects all

Columns("D:K").Selec
Selection.EntireColumn.Hidden = Tru
Columns("E:E").Selec
Selection.EntireColumn.Hidden = Fals

The drop box list and return cell is on a hidden sheet where I have a name
range that will calculate to the actual column(s) to be unhidden e.g., E:E

How do I get the macro to use the value in the worksheet (the worksheet i
named "Controls" and the cell is named "shown" and is at C1. The projec
list is on a sheet named "Notebook"

I may as well ask, what is the equivalent of "echo off" where the action
are not shown while the macro is running

It seems to be the declaring the variable and using it in the select comman
that I am having trouble with

I appreciate your help

Stev



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Macro to Hide/Show Columns based on control cell value

Thank you so much. It works exactly like I intended.

Steve


"chris" wrote in message
...
Sheets("Controls").Range("Shown")
Sheets("Controls").ComboBox1.Text
Sheets("NoteBook").Columns("D:K")
Application.ScreenUpdating = False
Application.ScreenUpdating = True

----- Steve N wrote: -----

This should be simple, but I am totally stumped.

I have a series of columns where each column represents a project. I

would
like to have only one column display at a time as determined by a

drop box
selection where the last entry is "All" and all of the projects are

show
when that is selected.

I recorded a macro to hide all of the columns, and then unhide the

one that
is selected, or unhide all if the user selects all.

Columns("D:K").Select
Selection.EntireColumn.Hidden = True
Columns("E:E").Select
Selection.EntireColumn.Hidden = False

The drop box list and return cell is on a hidden sheet where I have a

named
range that will calculate to the actual column(s) to be unhidden

e.g., E:E.

How do I get the macro to use the value in the worksheet (the

worksheet is
named "Controls" and the cell is named "shown" and is at C1. The

project
list is on a sheet named "Notebook".

I may as well ask, what is the equivalent of "echo off" where the

actions
are not shown while the macro is running?

It seems to be the declaring the variable and using it in the select

command
that I am having trouble with.

I appreciate your help.

Steve





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide Columns based on a cell value Tami Excel Worksheet Functions 10 July 16th 09 06:31 PM
Show or Hide control characters in a cell (using Excel 2007)... TK Excel Discussion (Misc queries) 0 June 5th 09 05:19 PM
Writing a macro to hide columns based on cell value JAbels001 Excel Discussion (Misc queries) 2 April 16th 09 05:02 PM
Macro to hide/show rows and columns Leo Excel Discussion (Misc queries) 4 May 23rd 06 05:25 PM
how can hide and show columns using macro? Hoshyar Excel Worksheet Functions 4 September 2nd 05 03:45 PM


All times are GMT +1. The time now is 10:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"