Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ned ned is offline
external usenet poster
 
Posts: 5
Default Worksheet_Change does not work

Hello;

I can not figure out why the following code will not work.

The range "LamTable" has data validation set to allow only items from a
list, or a blank. I want to change the cell to a blank when the user
selects "<none" from the list. I also want to change the value in the
corresponding row of the range "LamMultipliers" to 0.


Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo theEnd
Application.EnableEvents = False
If Not (Application.Intersect(Target, Me.[LamTable]) Is Nothing) Then
If Target.Value = "<none" Then
ActiveSheet.Cells(1, 1) = "Hello" 'error occurs here
Me.Cells(Target.Row, Target.Column).Formula = ""
Me.Cells(Target.Row, Me.[LamMultipliers].Column) = 0#
End If
End If
theEnd:
Application.EnableEvents = True
End Sub

I have spent about 4 hours trying different methods to accomplish the same
thing and none of them work.

The code gets the correct cells - I checked using the debugger. An error
1004 is raised whenever the code tries to modify any cell on the sheet. The
sheet is not protected.

--
Thanks in advance,

Stephen

__________________________________________________ __________________________
____
S. Fitzgerald, P.Eng, MASc.
Practical Composites, Inc.
Halifax, NS
Canada


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Worksheet_Change does not work

Stephen,

I just plugged the code into my worksheet and it worked fine for me. XL2000,
XP Pro.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"ned" <pcompNOSPAMatCanada.com wrote in message
...
Hello;

I can not figure out why the following code will not work.

The range "LamTable" has data validation set to allow only items from a
list, or a blank. I want to change the cell to a blank when the user
selects "<none" from the list. I also want to change the value in the
corresponding row of the range "LamMultipliers" to 0.


Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo theEnd
Application.EnableEvents = False
If Not (Application.Intersect(Target, Me.[LamTable]) Is Nothing) Then
If Target.Value = "<none" Then
ActiveSheet.Cells(1, 1) = "Hello" 'error occurs here
Me.Cells(Target.Row, Target.Column).Formula = ""
Me.Cells(Target.Row, Me.[LamMultipliers].Column) = 0#
End If
End If
theEnd:
Application.EnableEvents = True
End Sub

I have spent about 4 hours trying different methods to accomplish the same
thing and none of them work.

The code gets the correct cells - I checked using the debugger. An error
1004 is raised whenever the code tries to modify any cell on the sheet.

The
sheet is not protected.

--
Thanks in advance,

Stephen


__________________________________________________ __________________________
____
S. Fitzgerald, P.Eng, MASc.
Practical Composites, Inc.
Halifax, NS
Canada




  #3   Report Post  
Posted to microsoft.public.excel.programming
ned ned is offline
external usenet poster
 
Posts: 5
Default Worksheet_Change does not work

Bob;

Thanks for the reply. It works for me until I add the Data Validation on
the Range "LamTable". After that it fails when I try to change any cell on
the sheet. Did you apply data validation to limit cells in LamTable to a
list?

Thanks,

Stephen

"Bob Phillips" wrote in message
...
Stephen,

I just plugged the code into my worksheet and it worked fine for me.

XL2000,
XP Pro.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Worksheet_Change does not work

Stephen,

Yes I did. I had a 5 cell LamTable, and I applied a DV list of a,b,c,<none.

DV does not trigger a change event in XL97. Which version do you have?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"ned" <pcompNOSPAMatCanada.com wrote in message
...
Bob;

Thanks for the reply. It works for me until I add the Data Validation on
the Range "LamTable". After that it fails when I try to change any cell

on
the sheet. Did you apply data validation to limit cells in LamTable to a
list?

Thanks,

Stephen

"Bob Phillips" wrote in message
...
Stephen,

I just plugged the code into my worksheet and it worked fine for me.

XL2000,
XP Pro.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)





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
Worksheet_Change help Soundman Excel Discussion (Misc queries) 3 June 30th 06 10:46 PM
Getting around Worksheet_Change() mtowle Excel Worksheet Functions 1 October 20th 05 06:05 PM
Worksheet_Change Greg Bloom Excel Programming 1 November 5th 03 08:44 PM
worksheet_change vs. calculate, and worksheet_change not running Tom Ogilvy Excel Programming 1 July 14th 03 02:51 AM
worksheet_change vs. calculate, and worksheet_change not running Ross[_5_] Excel Programming 0 July 13th 03 04:27 PM


All times are GMT +1. The time now is 09:30 PM.

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"