Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Application.Screenupdating only on enter or on click, not with arr

I have an application where a worksheet named 'weightage table' is used to
control weightages of items on 7 other worksheets. The user is supposed to be
able to change weightage on this worksheet to zero or back above zero, and
the row with the items in the respective worksheets should hide or unhide
accordingly. This feature works only if after changing the weightage the user
either presses enter of clicks on another cell, but will not work if the user
uses the arrow keys or the tab key to move away from the cell. This causes
problems as another feature of the application allows the removal of items
from all the worksheets, but runs into error if item is hidden in one of the
worksheets.
Below is my code, a little messy as I did get parts of it from other places
and tweaked till I thought it worked. Thanks in advance
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ModelSheet As String
Dim R As Long

'Application.EnableEvents = True
Application.ScreenUpdating = False
Select Case ActiveCell.Offset(-1, 0).Column
Case 2
ModelSheet = Sheet10.Name
Case 3
ModelSheet = Sheet3.Name
Case 4
ModelSheet = Sheet5.Name
Case 5
ModelSheet = Sheet6.Name
Case 6
ModelSheet = Sheet7.Name
Case 7
ModelSheet = Sheet8.Name
Case 8
ModelSheet = Sheet9.Name
End Select
' Hidding or unhidding row where cell value is 0
R = ActiveCell.Offset(2, 0).Row
If ActiveCell.Offset(-1, 0).Value = "0" Then
Worksheets(ModelSheet).Rows(R).Hidden = True
ElseIf ActiveCell.Offset(-1, 0).Value "0" Then
Worksheets(ModelSheet).Rows(R).Hidden = False
End If
Application.ScreenUpdating = True
End Sub



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 411
Default Application.Screenupdating only on enter or on click, not witharr

Is part of the code highlighted with an error?

Does the code run?
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Application.Screenupdating only on enter or on click, not with

Dan,
Yes, the following is high lighted, the 4th line from the bottom. I think
when I remove an item using the other feature, it tries to update the hide
unhide function but fails because the item is no longer there, does that make
sense?
Worksheets(ModelSheet).Rows(R).Hidden = False


"dan dungan" wrote:

Is part of the code highlighted with an error?

Does the code run?

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
Application.ScreenUpdating Barb Reinhardt Excel Programming 2 August 1st 08 07:17 PM
application screenupdating issue Gary Keramidas Excel Programming 4 March 11th 06 02:45 AM
PLEASE PLEASE HELP Application.Screenupdating modjoe23[_6_] Excel Programming 3 September 3rd 05 05:08 AM
Application.ScreenUpdating problem jkitzy Excel Programming 3 January 12th 05 09:27 PM
Question on application.screenupdating augustus Excel Programming 2 December 18th 04 01:35 AM


All times are GMT +1. The time now is 08:46 PM.

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

About Us

"It's about Microsoft Excel"