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

I am using a change event to call a macro when any field in a specified
column is changed. The code appears below. Generally, only one cell at a
time will be changed, but in the even the user changes multiple cells at once
(e.g. pastes values) this code does not work because the target is a range
rather than a single cell. Can anyone help me to adapt the code to handle a
range rather than a single cell? Thanks much in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default change event

Your code isnt below....

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

Yeah I realized that at about the same time I clicked on Post.

Private Sub Worksheet_change(ByVal Target As Range)
Dim n As Integer

If Target.Column = 5 Then
If Target.Value = "Done" Then
n = Target.Row
Rows(n).Cut
Call moveEntry(n)
End If
End If

"Chip" wrote:

Your code isnt below....


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

You should not mixup Range and a single Cell, since a range may consist of
several cells and subranges.

Hope i didn't confused you to much


Greetings Jonjo

"xlcharlie" wrote:

I am using a change event to call a macro when any field in a specified
column is changed. The code appears below. Generally, only one cell at a
time will be changed, but in the even the user changes multiple cells at once
(e.g. pastes values) this code does not work because the target is a range
rather than a single cell. Can anyone help me to adapt the code to handle a
range rather than a single cell? Thanks much in advance.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default change event

err.... code?

As a guess you might try using something like:

dim c as range

for each c in ChangedRange
'process cell
next c


Tim.




"xlcharlie" wrote in message
...
I am using a change event to call a macro when any field in a specified
column is changed. The code appears below. Generally, only one cell at a
time will be changed, but in the even the user changes multiple cells at

once
(e.g. pastes values) this code does not work because the target is a range
rather than a single cell. Can anyone help me to adapt the code to handle

a
range rather than a single cell? Thanks much in advance.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default change event

Private Sub Worksheet_Change(ByVal Target As Range)
Dim N As Integer
Dim cell As Range

If Target.Column = 5 Then
For Each cell In Target
If cell.Value = "Done" Then
N = cell.Row
Rows(N).Cut
Call moveEntry(N)
End If
Next cell
End If

End Sub




--

HTH

RP
(remove nothere from the email address if mailing direct)


"xlcharlie" wrote in message
...
Yeah I realized that at about the same time I clicked on Post.

Private Sub Worksheet_change(ByVal Target As Range)
Dim n As Integer

If Target.Column = 5 Then
If Target.Value = "Done" Then
n = Target.Row
Rows(n).Cut
Call moveEntry(n)
End If
End If

"Chip" wrote:

Your code isnt below....




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

Sorry here it comes:


Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Range
For Each r In Target.Areas
Debug.Print r.Address
Next
End Sub

As you can see, every change will be printed out in the Direct window, try
it out

Greetings Jonjo

"Tim Williams" wrote:

err.... code?

As a guess you might try using something like:

dim c as range

for each c in ChangedRange
'process cell
next c


Tim.




"xlcharlie" wrote in message
...
I am using a change event to call a macro when any field in a specified
column is changed. The code appears below. Generally, only one cell at a
time will be changed, but in the even the user changes multiple cells at

once
(e.g. pastes values) this code does not work because the target is a range
rather than a single cell. Can anyone help me to adapt the code to handle

a
range rather than a single cell? Thanks much in advance.




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
Change event Stefi Excel Programming 2 October 29th 04 11:55 AM
Change Cell from Validated List Not Firing Worksheet Change Event [email protected] Excel Programming 3 October 4th 04 03:00 AM
Chart Values that change based on Change event ExcelMonkey[_119_] Excel Programming 1 May 15th 04 03:43 AM
Change minimumscale with the change event of a combobox Herbert Chan Excel Programming 1 April 11th 04 12:43 PM
change event/after update event?? scrabtree23[_2_] Excel Programming 1 October 20th 03 07:09 PM


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