Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Hide or Unhide certain columns based on a cell value

Hello All

I have a worksheet which calculates payback percentages for Slot
machines, based on how many coins a person plays. Since machines vary
in the amount of coins they are allowed to play, I have the sheet set
up from one coin up to five coins. On the sheet, if they enter the
amount of coins, it should hide the columns that are not needed... eg:
If it is 3 coin machine, it will hide the calculation columns for the
fourth and fifth coin. If, after that, they change the number to 2
coins, it should hide the third coin calculation column, and so on. I
tried achieving this with a Case... Select approach, but I have having
no luck at all.
If anyone has some sort of basic code that hides a column in the same
sheet, based on a numeric input in a cell on that same sheet, please
help. Thank you for your time.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default Hide or Unhide certain columns based on a cell value

With a Worksheet_Change event procedu

'-----------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim lColumn As Long
If Intersect(Target, Range("A2")) Is Nothing Then Exit Sub
For lColumn = 2 To 5
Columns(lColumn).Hidden = lColumn Range("A2").Value
Next lColumn
End Sub
'-------------------------------------------------------------------

See example: http://cjoint.com/?hkljrxXed6

HTH
--
AP

a écrit dans le message de news:
...
Hello All

I have a worksheet which calculates payback percentages for Slot
machines, based on how many coins a person plays. Since machines vary
in the amount of coins they are allowed to play, I have the sheet set
up from one coin up to five coins. On the sheet, if they enter the
amount of coins, it should hide the columns that are not needed... eg:
If it is 3 coin machine, it will hide the calculation columns for the
fourth and fifth coin. If, after that, they change the number to 2
coins, it should hide the third coin calculation column, and so on. I
tried achieving this with a Case... Select approach, but I have having
no luck at all.
If anyone has some sort of basic code that hides a column in the same
sheet, based on a numeric input in a cell on that same sheet, please
help. Thank you for your time.



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 or unhide sheets based on cell billinr Excel Discussion (Misc queries) 2 July 13th 07 07:42 PM
PROBLEM: hide/unhide worksheets based on cell value change [email protected] Excel Programming 3 May 31st 06 02:23 PM
Hide or Unhide Column Based on Cell Value windsurferLA Excel Programming 2 March 31st 06 11:06 PM
Hide/Unhide column based on cell value DRK Excel Programming 2 August 8th 05 04:17 PM
Hide/unhide sheet macro based on cell calculation Greg Fisher Excel Programming 3 May 26th 05 05:58 PM


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

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

About Us

"It's about Microsoft Excel"