#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default cell change

I have the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo stoppit
Application.EnableEvents = False
With Me.Range("drw1inforng")
If .Value < "" Then
MsgBox ("")
End If
End With
stoppit:
Application.EnableEvents = True

End Sub

'drw1inforng' is a named range on my sheet. When I make a change in this
range, nothing happens. What am I doing wrong here?
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default cell change

What would you like to happen?

The code executes when any cell on the sheet changes but your don't tell it
to do anything. Here's a guess that does something and may get you going:-

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo stoppit
Application.EnableEvents = False
For Each c In Range("drw1inforng")
If c.Value < "" Then
MsgBox c.Value
End If
Next
stoppit:
Application.EnableEvents = True
End Sub

Mike

"ranswert" wrote:

I have the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo stoppit
Application.EnableEvents = False
With Me.Range("drw1inforng")
If .Value < "" Then
MsgBox ("")
End If
End With
stoppit:
Application.EnableEvents = True

End Sub

'drw1inforng' is a named range on my sheet. When I make a change in this
range, nothing happens. What am I doing wrong here?
Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default cell change

I am looking for a way to run a macro when a cell in a range is changed. I
used the code that you suggested and each time a cell is changed, it goes
thru all the cells in that range. i only need it to work on the cell that is
change within a range of cells. How do I do this?
Thanks

"Mike H" wrote:

What would you like to happen?

The code executes when any cell on the sheet changes but your don't tell it
to do anything. Here's a guess that does something and may get you going:-

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo stoppit
Application.EnableEvents = False
For Each c In Range("drw1inforng")
If c.Value < "" Then
MsgBox c.Value
End If
Next
stoppit:
Application.EnableEvents = True
End Sub

Mike

"ranswert" wrote:

I have the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo stoppit
Application.EnableEvents = False
With Me.Range("drw1inforng")
If .Value < "" Then
MsgBox ("")
End If
End With
stoppit:
Application.EnableEvents = True

End Sub

'drw1inforng' is a named range on my sheet. When I make a change in this
range, nothing happens. What am I doing wrong here?
Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default cell change

Works fine for me! Good luck.

"ranswert" wrote:

I have the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo stoppit
Application.EnableEvents = False
With Me.Range("drw1inforng")
If .Value < "" Then
MsgBox ("")
End If
End With
stoppit:
Application.EnableEvents = True

End Sub

'drw1inforng' is a named range on my sheet. When I make a change in this
range, nothing happens. What am I doing wrong here?
Thanks

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default cell change

Try the UNION method with Target and drw1inforng ranges

"ranswert" wrote:

I am looking for a way to run a macro when a cell in a range is changed. I
used the code that you suggested and each time a cell is changed, it goes
thru all the cells in that range. i only need it to work on the cell that is
change within a range of cells. How do I do this?
Thanks

"Mike H" wrote:

What would you like to happen?

The code executes when any cell on the sheet changes but your don't tell it
to do anything. Here's a guess that does something and may get you going:-

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo stoppit
Application.EnableEvents = False
For Each c In Range("drw1inforng")
If c.Value < "" Then
MsgBox c.Value
End If
Next
stoppit:
Application.EnableEvents = True
End Sub

Mike

"ranswert" wrote:

I have the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo stoppit
Application.EnableEvents = False
With Me.Range("drw1inforng")
If .Value < "" Then
MsgBox ("")
End If
End With
stoppit:
Application.EnableEvents = True

End Sub

'drw1inforng' is a named range on my sheet. When I make a change in this
range, nothing happens. What am I doing wrong here?
Thanks



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default cell change

Can you give me an example?

"SparkyUK" wrote:

Try the UNION method with Target and drw1inforng ranges

"ranswert" wrote:

I am looking for a way to run a macro when a cell in a range is changed. I
used the code that you suggested and each time a cell is changed, it goes
thru all the cells in that range. i only need it to work on the cell that is
change within a range of cells. How do I do this?
Thanks

"Mike H" wrote:

What would you like to happen?

The code executes when any cell on the sheet changes but your don't tell it
to do anything. Here's a guess that does something and may get you going:-

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo stoppit
Application.EnableEvents = False
For Each c In Range("drw1inforng")
If c.Value < "" Then
MsgBox c.Value
End If
Next
stoppit:
Application.EnableEvents = True
End Sub

Mike

"ranswert" wrote:

I have the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo stoppit
Application.EnableEvents = False
With Me.Range("drw1inforng")
If .Value < "" Then
MsgBox ("")
End If
End With
stoppit:
Application.EnableEvents = True

End Sub

'drw1inforng' is a named range on my sheet. When I make a change in this
range, nothing happens. What am I doing wrong here?
Thanks

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default cell change

Sorry should have used INTERSECT method:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngUnion As Range

Set rngUnion = Application.Intersect(Target, Me.Range("drw1inforng"))

If Not (rngUnion Is Nothing) Then
On Error GoTo stoppit
Application.EnableEvents = False
If rngUnion.Value < "" Then MsgBox ("Not blank")
End If

stoppit:
Application.EnableEvents = True

End Sub

-----

"ranswert" wrote:

Can you give me an example?

"SparkyUK" wrote:

Try the UNION method with Target and drw1inforng ranges

"ranswert" wrote:

I am looking for a way to run a macro when a cell in a range is changed. I
used the code that you suggested and each time a cell is changed, it goes
thru all the cells in that range. i only need it to work on the cell that is
change within a range of cells. How do I do this?
Thanks

"Mike H" wrote:

What would you like to happen?

The code executes when any cell on the sheet changes but your don't tell it
to do anything. Here's a guess that does something and may get you going:-

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo stoppit
Application.EnableEvents = False
For Each c In Range("drw1inforng")
If c.Value < "" Then
MsgBox c.Value
End If
Next
stoppit:
Application.EnableEvents = True
End Sub

Mike

"ranswert" wrote:

I have the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo stoppit
Application.EnableEvents = False
With Me.Range("drw1inforng")
If .Value < "" Then
MsgBox ("")
End If
End With
stoppit:
Application.EnableEvents = True

End Sub

'drw1inforng' is a named range on my sheet. When I make a change in this
range, nothing happens. What am I doing wrong here?
Thanks

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default cell change

Thanks I'll give it a try

"SparkyUK" wrote:

Sorry should have used INTERSECT method:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngUnion As Range

Set rngUnion = Application.Intersect(Target, Me.Range("drw1inforng"))

If Not (rngUnion Is Nothing) Then
On Error GoTo stoppit
Application.EnableEvents = False
If rngUnion.Value < "" Then MsgBox ("Not blank")
End If

stoppit:
Application.EnableEvents = True

End Sub

-----

"ranswert" wrote:

Can you give me an example?

"SparkyUK" wrote:

Try the UNION method with Target and drw1inforng ranges

"ranswert" wrote:

I am looking for a way to run a macro when a cell in a range is changed. I
used the code that you suggested and each time a cell is changed, it goes
thru all the cells in that range. i only need it to work on the cell that is
change within a range of cells. How do I do this?
Thanks

"Mike H" wrote:

What would you like to happen?

The code executes when any cell on the sheet changes but your don't tell it
to do anything. Here's a guess that does something and may get you going:-

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo stoppit
Application.EnableEvents = False
For Each c In Range("drw1inforng")
If c.Value < "" Then
MsgBox c.Value
End If
Next
stoppit:
Application.EnableEvents = True
End Sub

Mike

"ranswert" wrote:

I have the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo stoppit
Application.EnableEvents = False
With Me.Range("drw1inforng")
If .Value < "" Then
MsgBox ("")
End If
End With
stoppit:
Application.EnableEvents = True

End Sub

'drw1inforng' is a named range on my sheet. When I make a change in this
range, nothing happens. What am I doing wrong here?
Thanks

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default cell change

will this doit

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("drw1inforng")) Is Nothing Then
MsgBox Target.Value
End If
End Sub

Mike

"ranswert" wrote:

I am looking for a way to run a macro when a cell in a range is changed. I
used the code that you suggested and each time a cell is changed, it goes
thru all the cells in that range. i only need it to work on the cell that is
change within a range of cells. How do I do this?
Thanks

"Mike H" wrote:

What would you like to happen?

The code executes when any cell on the sheet changes but your don't tell it
to do anything. Here's a guess that does something and may get you going:-

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo stoppit
Application.EnableEvents = False
For Each c In Range("drw1inforng")
If c.Value < "" Then
MsgBox c.Value
End If
Next
stoppit:
Application.EnableEvents = True
End Sub

Mike

"ranswert" wrote:

I have the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo stoppit
Application.EnableEvents = False
With Me.Range("drw1inforng")
If .Value < "" Then
MsgBox ("")
End If
End With
stoppit:
Application.EnableEvents = True

End Sub

'drw1inforng' is a named range on my sheet. When I make a change in this
range, nothing happens. What am I doing wrong here?
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
How to trigger one cell change to change another cell using VB in excel? Please help! :) raytan Excel Programming 4 March 26th 07 03:49 AM
making copied cells change with change in original cell Jennifer Mcdermeit Excel Worksheet Functions 2 July 20th 06 04:58 PM
Cell value change to trigger macro (worksheet change event?) Neil Goldwasser Excel Programming 4 January 10th 06 01:55 PM
Change workbook sheet reference using cell A1 to change a vairable Reed Excel Worksheet Functions 4 January 20th 05 07:15 PM
Change Cell from Validated List Not Firing Worksheet Change Event [email protected] Excel Programming 3 October 4th 04 03:00 AM


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