Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
jat jat is offline
external usenet poster
 
Posts: 33
Default disable brian baulsom's worksheet change based on cell value.

i am using the following worksheet change code in cell L5:

Private Sub Worksheet_Change(ByVal Target As Range)
'================================================= ==========
'- Brian Baulsom November 2008
'================================================= ===========

'- Saves the value in this subroutine
Static L5value As Variant
'--------------------------------------------------------
'- check if the saved value is the same as it was
If L5value < Range("L5").Value Then
L5value = Range("L5").Value
Application.ScreenUpdating = False
Sheets("Items").Select
Call DisplaySelected
Sheets("Purchase Order (Inventory)").Select
Application.ScreenUpdating = True
End If
End Sub

- the cell L5 uses a vlookup to return value and this works in every
instance. but on occassion, i need this code disabled, without actually
deleting the code.

the maco saves the file as a pdf without any issues, but when the cell L5
returns the value CLAIM, i need to save it as an excel file. as long as this
code is in the workbook, i keep getting various errors, but if i remove this
code it saves as an excel file fine.

any ideas would be appreciated.

thank you,

jat

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default disable brian baulsom's worksheet change based on cell value.

You can use Application.Enableevents = false to disable the events.. Please
make sure to set that to true after the code is executed..or once the change
is complete.


If this post helps click Yes
---------------
Jacob Skaria


"jat" wrote:

i am using the following worksheet change code in cell L5:

Private Sub Worksheet_Change(ByVal Target As Range)
'================================================= ==========
'- Brian Baulsom November 2008
'================================================= ===========

'- Saves the value in this subroutine
Static L5value As Variant
'--------------------------------------------------------
'- check if the saved value is the same as it was
If L5value < Range("L5").Value Then
L5value = Range("L5").Value
Application.ScreenUpdating = False
Sheets("Items").Select
Call DisplaySelected
Sheets("Purchase Order (Inventory)").Select
Application.ScreenUpdating = True
End If
End Sub

- the cell L5 uses a vlookup to return value and this works in every
instance. but on occassion, i need this code disabled, without actually
deleting the code.

the maco saves the file as a pdf without any issues, but when the cell L5
returns the value CLAIM, i need to save it as an excel file. as long as this
code is in the workbook, i keep getting various errors, but if i remove this
code it saves as an excel file fine.

any ideas would be appreciated.

thank you,

jat

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,510
Default disable brian baulsom's worksheet change based on cell value.

Hi Jat,

Another option is to Exit the sub if L5 = CLAIM

Private Sub Worksheet_Change(ByVal Target As Range)
'================================================= ==========
'- Brian Baulsom November 2008
'================================================= ===========

If UCase(Range("L5").Value) = "CLAIM" Then
Exit Sub
End If

'- Saves the value in this subroutine
Static L5value As Variant

'--------------------------------------------------------
'- check if the saved value is the same as it was
If L5value < Range("L5").Value Then
L5value = Range("L5").Value
Application.ScreenUpdating = False
Sheets("Items").Select
MsgBox "Called"
'Call DisplaySelected
Sheets("Purchase Order (Inventory)").Select
Application.ScreenUpdating = True
End If

End Sub


--
Regards,

OssieMac


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
Brian - Creating a option button Excel Excel Discussion (Misc queries) 1 March 3rd 09 09:19 PM
How do I set up worksheet tabs to change based on a workbook cell LJVG Excel Worksheet Functions 1 January 16th 09 06:15 PM
Change Text Color in one cell based upon entry in referenced cell Tee Excel Discussion (Misc queries) 3 September 12th 08 10:07 PM
Is there a way to disable a macro based on the value of a cell? Jeff Excel Discussion (Misc queries) 1 March 7th 08 06:43 PM
enable/disable button based on cell value Shoney Excel Discussion (Misc queries) 3 January 9th 08 07:34 PM


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