Solved

Selective Display Of Cells In Excel

Posted on 2002-05-23
5
192 Views
Last Modified: 2010-05-18
Hi,

I have a problem with Excel.

I have a spreadsheet which has an Auto_Open module which selectivly hides or unhides cells dependant on the user.  However I now need to unhide a cell based on what the user enters into another cell...it breaks down thus...

X4 is hidden but when B4>0 I want to unhide it.

Is there a cell event change event in Excel VBA that I can tap into to do this?
0
Comment
Question by:WHITER99
  • 3
5 Comments
 
LVL 44

Accepted Solution

by:
bruintje earned 100 total points
Comment Utility
Hi, WHITER99

-in excel open the VB editor (ALT+F11)
-then double click the ThisWorkBook icon
-paste the code

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
  If Target.Address = "$B$4" Then
    If Target.Value > 0 Then
      Columns("Z:Z").Select
      Selection.EntireColumn.Hidden = False
    End If
  End If
End Sub

-this will make the complete column Z visible
-you can't hide or unhide one cell only columns

HTH:O)Bruintje
0
 
LVL 18

Expert Comment

by:bobbit31
Comment Utility
bruintje:

I take it you've had lots of experience w/ Excel Object Library ;) (you answer all of the excel questions first!)

0
 
LVL 44

Expert Comment

by:bruintje
Comment Utility
Hi bobbit31, i like them more then picking some API calls or doing some ASP stuff like i do for my job ;)
0
 

Author Comment

by:WHITER99
Comment Utility
Thanks,

It was much easier than I thought it would be but then it always is when somebidy gives you the answer.

Thanks again.
0
 
LVL 44

Expert Comment

by:bruintje
Comment Utility
Hi WHITER99, i guess the autograde made it a B?
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now