Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Event Programming - Cell Value change - 2 sheets involved - VBA - Excel
Hi,
I got an excel file consisting of 3 sheets. I want to hide rows 53 to 88 in the last sheet called "Expense Report" whenever there is a value (letters) entered in cell C6 in the sheet "General Info". I know I need a Worksheet_SelectionChange event and this is what I came up with. However it does not work. This is what I programmed: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Sheets("General Info").Select APPILCATION.Goto C6 If (ActiveCell.Value 0) Then Sheets("Expense Report").Select Range("53:88").EntireRow.Hidden = True Else Range("53:88").EntireRow.Hidden = FALSE End If End Sub Any help? Where do I need to put the code when I open the VBA-editor? Regards |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Event Programming - Cell Value change - 2 sheets involved - VBA -
Try putting this in the sheet code for "General Info"
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address(False, False) < "C6" Then Exit Sub If Target 0 Then Worksheets("Expense Report").Range("A53:A88").EntireRow.Hidden = True Else Worksheets("Expense Report").Range("A53:A88").EntireRow.Hidden = False End If End Sub -- Charles Chickering "A good example is twice the value of good advice." " wrote: Hi, I got an excel file consisting of 3 sheets. I want to hide rows 53 to 88 in the last sheet called "Expense Report" whenever there is a value (letters) entered in cell C6 in the sheet "General Info". I know I need a Worksheet_SelectionChange event and this is what I came up with. However it does not work. This is what I programmed: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Sheets("General Info").Select APPILCATION.Goto C6 If (ActiveCell.Value 0) Then Sheets("Expense Report").Select Range("53:88").EntireRow.Hidden = True Else Range("53:88").EntireRow.Hidden = FALSE End If End Sub Any help? Where do I need to put the code when I open the VBA-editor? Regards |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Cell change event causing EXCEL to crash | Excel Worksheet Functions | |||
Excel VBA Programming...How to Trigger an Event WhenYou Move Off a Cell | Excel Programming | |||
Cell value change to trigger macro (worksheet change event?) | Excel Programming | |||
Change Cell from Validated List Not Firing Worksheet Change Event | Excel Programming | |||
Copy Sheets minus Worksheet Change Event code & Macro Buttons | Excel Programming |