PC Review


Reply
Thread Tools Rate Thread

Change Event

 
 
Risky Dave
Guest
Posts: n/a
 
      19th Aug 2009
Hi,

I am struggling to do something that I think should be easy, but I can't
figure it out.

I have a sheet within which I need to respond to specific changes:
If a cell in column H or column L is chnaged, I need to chnage the value in
column M of the same row.

I don't know which row will be altered, so I am trying to use a Worksheet
Change Event to trap the change with:

Private Sub Worksheet_Change(ByVal Target As Range)

Select Case True
Case Target.Column=8 or Target.Column=12
<update cell "M" in Target.Row>
End Select
End Sub

What I can't figure out is the <update cell "M" in Target.Row> code. I can
capture the Target.Row to a string but can't covert the string to a range to
update cell M Target.Row and I can't help thinking that there must be a
better way of doing things anyway.

This is in Office '07 under Vista FWIW

Any suggestions on how I achieve this would be gratefully received.

Hope this makes sense!

TIA

Dave


 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      19th Aug 2009
Try the below. Right click the sheet tab>View Code and paste the below code

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("H:H,L:L")) Is Nothing Then
Range("M" & Target.Row) = "Changed H/L"
End If
Application.EnableEvents = True
End Sub

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


"Risky Dave" wrote:

> Hi,
>
> I am struggling to do something that I think should be easy, but I can't
> figure it out.
>
> I have a sheet within which I need to respond to specific changes:
> If a cell in column H or column L is chnaged, I need to chnage the value in
> column M of the same row.
>
> I don't know which row will be altered, so I am trying to use a Worksheet
> Change Event to trap the change with:
>
> Private Sub Worksheet_Change(ByVal Target As Range)
>
> Select Case True
> Case Target.Column=8 or Target.Column=12
> <update cell "M" in Target.Row>
> End Select
> End Sub
>
> What I can't figure out is the <update cell "M" in Target.Row> code. I can
> capture the Target.Row to a string but can't covert the string to a range to
> update cell M Target.Row and I can't help thinking that there must be a
> better way of doing things anyway.
>
> This is in Office '07 under Vista FWIW
>
> Any suggestions on how I achieve this would be gratefully received.
>
> Hope this makes sense!
>
> TIA
>
> Dave
>
>

 
Reply With Quote
 
Risky Dave
Guest
Posts: n/a
 
      19th Aug 2009
Thanks

"Jacob Skaria" wrote:

> Try the below. Right click the sheet tab>View Code and paste the below code
>
> Private Sub Worksheet_Change(ByVal Target As Range)
> Application.EnableEvents = False
> If Not Application.Intersect(Target, Range("H:H,L:L")) Is Nothing Then
> Range("M" & Target.Row) = "Changed H/L"
> End If
> Application.EnableEvents = True
> End Sub
>
> If this post helps click Yes
> ---------------
> Jacob Skaria
>
>
> "Risky Dave" wrote:
>
> > Hi,
> >
> > I am struggling to do something that I think should be easy, but I can't
> > figure it out.
> >
> > I have a sheet within which I need to respond to specific changes:
> > If a cell in column H or column L is chnaged, I need to chnage the value in
> > column M of the same row.
> >
> > I don't know which row will be altered, so I am trying to use a Worksheet
> > Change Event to trap the change with:
> >
> > Private Sub Worksheet_Change(ByVal Target As Range)
> >
> > Select Case True
> > Case Target.Column=8 or Target.Column=12
> > <update cell "M" in Target.Row>
> > End Select
> > End Sub
> >
> > What I can't figure out is the <update cell "M" in Target.Row> code. I can
> > capture the Target.Row to a string but can't covert the string to a range to
> > update cell M Target.Row and I can't help thinking that there must be a
> > better way of doing things anyway.
> >
> > This is in Office '07 under Vista FWIW
> >
> > Any suggestions on how I achieve this would be gratefully received.
> >
> > Hope this makes sense!
> >
> > TIA
> >
> > Dave
> >
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
apply cell change event to single column - WorksheetChange Event MiataDiablo@gmail.com Microsoft Excel Programming 5 4th May 2008 02:28 AM
Problem with CommandBarComboBox Change Event (Event fires only once) M. Khalid Farooq Microsoft Outlook Interoperability 6 23rd Oct 2006 09:44 AM
Control where change event does not trigger click event? =?Utf-8?B?c3dvcmRmaXNo?= Microsoft Powerpoint 2 17th Jul 2006 06:21 PM
MsgBox in Enter event causes combobox not to run Change event =?Utf-8?B?UmljaGFyZA==?= Microsoft Excel Programming 0 6th Mar 2006 02:52 PM
Datagrid cell change event? Where to find event. Roger Microsoft VB .NET 4 29th Mar 2005 09:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:25 PM.