Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default worksheet change not triggering

I've been working on the code below which is in "ThisWorkbook". I
edited the if statements down toward the end, and now the macro
doesn't trigger when I change a value in the sheet. I'm confused,
again!

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)

Dim rFoundShName As Range
Dim rShNames As Range
Dim wsPwrdNames As Worksheet
Dim vResponse As Variant
Set wsPwrdNames = ThisWorkbook.Sheets("sheet1")
Set rShNames = wsPwrdNames.Range("ShNames")

Application.EnableEvents = False

wsPwrdNames.Visible = True
bPwrdEntrd = False
PwrdForm:
ufPwrdEntry.Show

Set rFoundShName = rShNames.Find(ActiveSheet.Name, _
LookIn:=xlValues, _
LookAt:=xlWhole)

If sPwrd = rFoundShName.Offset(0, 1).Value Then
bPwrdEntrd = True
Else
vResponse = MsgBox("Incorrect Password! Click OK to try again,
Cancel to exit", _
vbOKCancel)
If vResponse = vbCancel Then
End
Else
GoTo PwrdForm

End If
End If
wsPwrdNames.Visible = False

End
Application.Undo

bPwrdEntrd = False
Application.EnableEvents = True
End Sub

Private Sub Workbook_SheetDeactivate(ByVal ws As Object)
bPwrdEntrd = False
End Sub

And suggestions? I'm particularly curious as to how changing the code
down below can prevent the macro from triggering at all!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default worksheet change not triggering

On Jan 30, 3:49 pm, "davegb" wrote:
I've been working on the code below which is in "ThisWorkbook". I
edited the if statements down toward the end, and now the macro
doesn't trigger when I change a value in the sheet. I'm confused,
again!

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)

Dim rFoundShName As Range
Dim rShNames As Range
Dim wsPwrdNames As Worksheet
Dim vResponse As Variant
Set wsPwrdNames = ThisWorkbook.Sheets("sheet1")
Set rShNames = wsPwrdNames.Range("ShNames")

Application.EnableEvents = False

wsPwrdNames.Visible = True
bPwrdEntrd = False
PwrdForm:
ufPwrdEntry.Show

Set rFoundShName = rShNames.Find(ActiveSheet.Name, _
LookIn:=xlValues, _
LookAt:=xlWhole)

If sPwrd = rFoundShName.Offset(0, 1).Value Then
bPwrdEntrd = True
Else
vResponse = MsgBox("Incorrect Password! Click OK to try again,
Cancel to exit", _
vbOKCancel)
If vResponse = vbCancel Then
End
Else
GoTo PwrdForm

End If
End If
wsPwrdNames.Visible = False

End
Application.Undo

bPwrdEntrd = False
Application.EnableEvents = True
End Sub

Private Sub Workbook_SheetDeactivate(ByVal ws As Object)
bPwrdEntrd = False
End Sub

And suggestions? I'm particularly curious as to how changing the code
down below can prevent the macro from triggering at all!


I figured it out! Thanks!

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
Autocomplete not triggering worksheet change Graham Haughs Excel Programming 7 November 20th 06 07:07 AM
RTD value changes not triggering worksheet change event DTM[_4_] Excel Programming 2 June 7th 06 05:01 PM
Validation not triggering Change event in Excel XP Jeffrey[_8_] Excel Programming 3 March 13th 06 03:33 AM
Validation not triggering Change event in Excel XP Jeffrey[_8_] Excel Programming 1 March 8th 06 01:59 AM
help on triggering macro if cells change cuewoz Excel Programming 6 March 6th 06 07:52 PM


All times are GMT +1. The time now is 07:19 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"