Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Create a "cell button" to hide selected cells.

I want to setup or enter a function in a cell that will allow me to use that
cell as a "button". I want to setup this cell so that when I click on it, it
will hide selected cells.

For example:

Clicking on cell "A1" allows me to hide columns D,E and F.

I'd appreciate any kind of help on this.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default Create a "cell button" to hide selected cells.

If your post can be interpreted literally...meaning that you want a button to
hide/unhide entire columns...
Try this:

Select columns D,E, and F

From the Excel main menu:
<data<group and outline<Group

That will display a [-] button above the worksheet.
Clicking on that button hides the columns and changes the button to [+]
Click on the [+] button to redisplay the columns.

Post back with any questions.
Does that help?
***********
Regards,
Ron

XL2002, WinXP


"Shoolin Patel" wrote:

I want to setup or enter a function in a cell that will allow me to use that
cell as a "button". I want to setup this cell so that when I click on it, it
will hide selected cells.

For example:

Clicking on cell "A1" allows me to hide columns D,E and F.

I'd appreciate any kind of help on this.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Create a "cell button" to hide selected cells.

Hey Ron,

That's a neat thing to know, but it still didn't help me with my problem. I
guess I am to be blame for that, I did a very poor job of describing my
situation.

I'll take another stab at it......

So far, I have entered Jan, Feb, Mach.......prior year and year to date data
in columns.

Now, I want to create 12 buttons (one for each month) in column A. I want to
setup these buttons so that when I click on January button all other months'
columns are hidden, and I can only see January, prior year and year to date
columns.

I hope I did a better job of describing my situation. Thank for you help!!!

Shoolin

"Ron Coderre" wrote:

If your post can be interpreted literally...meaning that you want a button to
hide/unhide entire columns...
Try this:

Select columns D,E, and F

From the Excel main menu:
<data<group and outline<Group

That will display a [-] button above the worksheet.
Clicking on that button hides the columns and changes the button to [+]
Click on the [+] button to redisplay the columns.

Post back with any questions.
Does that help?
***********
Regards,
Ron

XL2002, WinXP


"Shoolin Patel" wrote:

I want to setup or enter a function in a cell that will allow me to use that
cell as a "button". I want to setup this cell so that when I click on it, it
will hide selected cells.

For example:

Clicking on cell "A1" allows me to hide columns D,E and F.

I'd appreciate any kind of help on this.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default Create a "cell button" to hide selected cells.

See if this example does what you want:

On Sheet1
In cells A1:A12 enter this list: Jan, Feb....Dec
Name that range: LU_MthList

Select B1 (still on Sheet1)
Name that range: MthChoice

Switch to Sheet2
In cells B1:M1 enter this list: Jan, Feb....Dec

Select entire columns B through M
Name that range: MonthCols

Using the FORMS toolbar
Create a ComboBox on Cell A1
While it's selected...
Type this in the NameBox (next to the formula bar): cboPickMth
Press [Enter]
(That just gives the ComboBox a name that makes sense)

Right-click on the cboPickMth ComboBox
Select: Format Control
Input Range: LU_MthList
Cell Link: MthChoice
Click the [OK] button

Right-click on the cboPickMth ComboBox (again)
Select: Assign Macro
Select: New

The VB editor should open and display the below empty procedu
Sub cboPickMth_Change()

End Sub

Copy the body of this code and paste it into the empty procedu
'--------start of code--------
Sub cboPickMth_Change()
Dim intPickMonth As Integer
intPickMonth = Range("MthChoice").Value

On Error GoTo errTrap
Application.ScreenUpdating = False
Range("MonthCols").EntireColumn.Hidden = False
If intPickMonth < 12 Then
Range("MonthCols") _
.Offset(ColumnOffset:=intPickMonth) _
.Resize(ColumnSize:=12 - intPickMonth) _
.EntireColumn _
.Hidden = True
End If
errTrap:
Application.ScreenUpdating = True
End Sub
'--------end of code--------

That's all....When you change the month in the ComboBox the appropriate
columns should show/hide.


Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"Shoolin Patel" wrote:

Hey Ron,

That's a neat thing to know, but it still didn't help me with my problem. I
guess I am to be blame for that, I did a very poor job of describing my
situation.

I'll take another stab at it......

So far, I have entered Jan, Feb, Mach.......prior year and year to date data
in columns.

Now, I want to create 12 buttons (one for each month) in column A. I want to
setup these buttons so that when I click on January button all other months'
columns are hidden, and I can only see January, prior year and year to date
columns.

I hope I did a better job of describing my situation. Thank for you help!!!

Shoolin

"Ron Coderre" wrote:

If your post can be interpreted literally...meaning that you want a button to
hide/unhide entire columns...
Try this:

Select columns D,E, and F

From the Excel main menu:
<data<group and outline<Group

That will display a [-] button above the worksheet.
Clicking on that button hides the columns and changes the button to [+]
Click on the [+] button to redisplay the columns.

Post back with any questions.
Does that help?
***********
Regards,
Ron

XL2002, WinXP


"Shoolin Patel" wrote:

I want to setup or enter a function in a cell that will allow me to use that
cell as a "button". I want to setup this cell so that when I click on it, it
will hide selected cells.

For example:

Clicking on cell "A1" allows me to hide columns D,E and F.

I'd appreciate any kind of help on this.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Create a "cell button" to hide selected cells.

Hey Ron,

Your last post helped a lot. The Macro that you gave almost did the trick.
There is only one change that I need to make. Currently, when I click on
March, or for that matter any month after January, the Macro shows all the
month prior to the month select and hides all the months that come after the
month selected. What I need, is for the Marco to hide all months before and
after the month selected.

Here is how I want the sheet to look if I selected March:

Column D Column N Column M
March Prior Year Year-to-Date

All other months (Jan, Feb and April to Dec) are hidden.

Thanks a lot for your help and time. I really appreciate it.

Shoolin

"Ron Coderre" wrote:

See if this example does what you want:

On Sheet1
In cells A1:A12 enter this list: Jan, Feb....Dec
Name that range: LU_MthList

Select B1 (still on Sheet1)
Name that range: MthChoice

Switch to Sheet2
In cells B1:M1 enter this list: Jan, Feb....Dec

Select entire columns B through M
Name that range: MonthCols

Using the FORMS toolbar
Create a ComboBox on Cell A1
While it's selected...
Type this in the NameBox (next to the formula bar): cboPickMth
Press [Enter]
(That just gives the ComboBox a name that makes sense)

Right-click on the cboPickMth ComboBox
Select: Format Control
Input Range: LU_MthList
Cell Link: MthChoice
Click the [OK] button

Right-click on the cboPickMth ComboBox (again)
Select: Assign Macro
Select: New

The VB editor should open and display the below empty procedu
Sub cboPickMth_Change()

End Sub

Copy the body of this code and paste it into the empty procedu
'--------start of code--------
Sub cboPickMth_Change()
Dim intPickMonth As Integer
intPickMonth = Range("MthChoice").Value

On Error GoTo errTrap
Application.ScreenUpdating = False
Range("MonthCols").EntireColumn.Hidden = False
If intPickMonth < 12 Then
Range("MonthCols") _
.Offset(ColumnOffset:=intPickMonth) _
.Resize(ColumnSize:=12 - intPickMonth) _
.EntireColumn _
.Hidden = True
End If
errTrap:
Application.ScreenUpdating = True
End Sub
'--------end of code--------

That's all....When you change the month in the ComboBox the appropriate
columns should show/hide.


Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"Shoolin Patel" wrote:

Hey Ron,

That's a neat thing to know, but it still didn't help me with my problem. I
guess I am to be blame for that, I did a very poor job of describing my
situation.

I'll take another stab at it......

So far, I have entered Jan, Feb, Mach.......prior year and year to date data
in columns.

Now, I want to create 12 buttons (one for each month) in column A. I want to
setup these buttons so that when I click on January button all other months'
columns are hidden, and I can only see January, prior year and year to date
columns.

I hope I did a better job of describing my situation. Thank for you help!!!

Shoolin

"Ron Coderre" wrote:

If your post can be interpreted literally...meaning that you want a button to
hide/unhide entire columns...
Try this:

Select columns D,E, and F

From the Excel main menu:
<data<group and outline<Group

That will display a [-] button above the worksheet.
Clicking on that button hides the columns and changes the button to [+]
Click on the [+] button to redisplay the columns.

Post back with any questions.
Does that help?
***********
Regards,
Ron

XL2002, WinXP


"Shoolin Patel" wrote:

I want to setup or enter a function in a cell that will allow me to use that
cell as a "button". I want to setup this cell so that when I click on it, it
will hide selected cells.

For example:

Clicking on cell "A1" allows me to hide columns D,E and F.

I'd appreciate any kind of help on this.



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default Create a "cell button" to hide selected cells.

OK...I understand better now

Replace the VBA code with this:

Sub cboPickMth_Change()
Dim intPickMonth As Integer
intPickMonth = Range("MthChoice").Value

On Error GoTo errTrap
Application.ScreenUpdating = False
With Range("MonthCols")
.EntireColumn.Hidden = True

.Offset(ColumnOffset:=intPickMonth - 1) _
.Resize(ColumnSize:=1) _
.EntireColumn _
.Hidden = False
End With
errTrap:
Application.ScreenUpdating = False
End Sub

Does that help?
***********
Regards,
Ron

XL2002, WinXP


"Shoolin Patel" wrote:

Hey Ron,

Your last post helped a lot. The Macro that you gave almost did the trick.
There is only one change that I need to make. Currently, when I click on
March, or for that matter any month after January, the Macro shows all the
month prior to the month select and hides all the months that come after the
month selected. What I need, is for the Marco to hide all months before and
after the month selected.

Here is how I want the sheet to look if I selected March:

Column D Column N Column M
March Prior Year Year-to-Date

All other months (Jan, Feb and April to Dec) are hidden.

Thanks a lot for your help and time. I really appreciate it.

Shoolin

"Ron Coderre" wrote:

See if this example does what you want:

On Sheet1
In cells A1:A12 enter this list: Jan, Feb....Dec
Name that range: LU_MthList

Select B1 (still on Sheet1)
Name that range: MthChoice

Switch to Sheet2
In cells B1:M1 enter this list: Jan, Feb....Dec

Select entire columns B through M
Name that range: MonthCols

Using the FORMS toolbar
Create a ComboBox on Cell A1
While it's selected...
Type this in the NameBox (next to the formula bar): cboPickMth
Press [Enter]
(That just gives the ComboBox a name that makes sense)

Right-click on the cboPickMth ComboBox
Select: Format Control
Input Range: LU_MthList
Cell Link: MthChoice
Click the [OK] button

Right-click on the cboPickMth ComboBox (again)
Select: Assign Macro
Select: New

The VB editor should open and display the below empty procedu
Sub cboPickMth_Change()

End Sub

Copy the body of this code and paste it into the empty procedu
'--------start of code--------
Sub cboPickMth_Change()
Dim intPickMonth As Integer
intPickMonth = Range("MthChoice").Value

On Error GoTo errTrap
Application.ScreenUpdating = False
Range("MonthCols").EntireColumn.Hidden = False
If intPickMonth < 12 Then
Range("MonthCols") _
.Offset(ColumnOffset:=intPickMonth) _
.Resize(ColumnSize:=12 - intPickMonth) _
.EntireColumn _
.Hidden = True
End If
errTrap:
Application.ScreenUpdating = True
End Sub
'--------end of code--------

That's all....When you change the month in the ComboBox the appropriate
columns should show/hide.


Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"Shoolin Patel" wrote:

Hey Ron,

That's a neat thing to know, but it still didn't help me with my problem. I
guess I am to be blame for that, I did a very poor job of describing my
situation.

I'll take another stab at it......

So far, I have entered Jan, Feb, Mach.......prior year and year to date data
in columns.

Now, I want to create 12 buttons (one for each month) in column A. I want to
setup these buttons so that when I click on January button all other months'
columns are hidden, and I can only see January, prior year and year to date
columns.

I hope I did a better job of describing my situation. Thank for you help!!!

Shoolin

"Ron Coderre" wrote:

If your post can be interpreted literally...meaning that you want a button to
hide/unhide entire columns...
Try this:

Select columns D,E, and F

From the Excel main menu:
<data<group and outline<Group

That will display a [-] button above the worksheet.
Clicking on that button hides the columns and changes the button to [+]
Click on the [+] button to redisplay the columns.

Post back with any questions.
Does that help?
***********
Regards,
Ron

XL2002, WinXP


"Shoolin Patel" wrote:

I want to setup or enter a function in a cell that will allow me to use that
cell as a "button". I want to setup this cell so that when I click on it, it
will hide selected cells.

For example:

Clicking on cell "A1" allows me to hide columns D,E and F.

I'd appreciate any kind of help on this.

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
Cells are selected but aren't displayed as selected Nifty Excel Discussion (Misc queries) 2 September 17th 06 07:22 PM
A validated List which link to selected cells according to what is selected on the list WL Excel Worksheet Functions 1 June 5th 06 08:52 PM
Excluding selected cells in excel Farhad Excel Discussion (Misc queries) 3 May 29th 06 08:45 PM
Can I create an Excel chart from non-contiguous data cells? [email protected](nospam) Charts and Charting in Excel 1 May 27th 06 02:45 AM
How can I create a drop down list from non-adjacent cells brian m. Excel Discussion (Misc queries) 4 January 28th 06 03:02 PM


All times are GMT +1. The time now is 06:45 AM.

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"