Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default 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
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
Cell change event causing EXCEL to crash Ashish Excel Worksheet Functions 3 January 9th 09 04:01 AM
Excel VBA Programming...How to Trigger an Event WhenYou Move Off a Cell [email protected] Excel Programming 2 April 17th 06 11:11 PM
Cell value change to trigger macro (worksheet change event?) Neil Goldwasser Excel Programming 4 January 10th 06 01:55 PM
Change Cell from Validated List Not Firing Worksheet Change Event [email protected] Excel Programming 3 October 4th 04 03:00 AM
Copy Sheets minus Worksheet Change Event code & Macro Buttons Bob[_36_] Excel Programming 0 October 8th 03 01:17 AM


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

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"