Solved

Selective Display Of Cells In Excel

Posted on 2002-05-23
5
194 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
ID: 7029988
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
ID: 7030079
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
ID: 7030189
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
ID: 7031378
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
ID: 7031404
Hi WHITER99, i guess the autograde made it a B?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB error "Type mismatch" 2 49
JSON Response and request in VB6 application 11 241
Recommendation vb6 to vb.net or others 14 109
vbModal 12 34
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

911 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

24 Experts available now in Live!

Get 1:1 Help Now