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

I have a worksheet change event so that when information is entered into
C2:C50 it will put relative data into E2:E50. except something is not
working. It's activating for every cell change on the entire sheet.

here's what I got:

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "C2:C50"
On Error GoTo ws_exit:
Set OldCell = Target

Application.EnableEvents = False

If Target < "" Then

With Target
CHANGECYCLE
End With
Else
GoTo ws_exit:
End If

Application.EnableEvents = True
ws_exit:
End Sub


The sub it goes to works as it should, but I only want it to work if the
C2:C50 is selected. What did I goof?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Worksheet change event-single column

Sorry that was what I was trying to do to fix it (it didn't work). This is
the original.

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "C2:C50"
On Error GoTo ws_exit:
Set OldCell = Target

Application.EnableEvents = False

With Target
CHANGECYCLE
End With

Application.EnableEvents = True
ws_exit:
End Sub



"jasminesy" wrote:

I have a worksheet change event so that when information is entered into
C2:C50 it will put relative data into E2:E50. except something is not
working. It's activating for every cell change on the entire sheet.

here's what I got:

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "C2:C50"
On Error GoTo ws_exit:
Set OldCell = Target

Application.EnableEvents = False

If Target < "" Then

With Target
CHANGECYCLE
End With
Else
GoTo ws_exit:
End If

Application.EnableEvents = True
ws_exit:
End Sub


The sub it goes to works as it should, but I only want it to work if the
C2:C50 is selected. What did I goof?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default I Got it - Sorry

I knew I was forgetting something: I forgot my intersect

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "C2:C50"
On Error GoTo ws_exit:
Set OldCell = Target
If Target < "" Then
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
CHANGECYCLE
End With
End If
End If
Application.EnableEvents = True
ws_exit:
End Sub



"jasminesy" wrote:

I have a worksheet change event so that when information is entered into
C2:C50 it will put relative data into E2:E50. except something is not
working. It's activating for every cell change on the entire sheet.

here's what I got:

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "C2:C50"
On Error GoTo ws_exit:
Set OldCell = Target

Application.EnableEvents = False

If Target < "" Then

With Target
CHANGECYCLE
End With
Else
GoTo ws_exit:
End If

Application.EnableEvents = True
ws_exit:
End Sub


The sub it goes to works as it should, but I only want it to work if the
C2:C50 is selected. What did I goof?

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 Event systemx[_3_] Excel Programming 1 January 27th 06 08:55 AM
Cell value change to trigger macro (worksheet change event?) Neil Goldwasser Excel Programming 4 January 10th 06 01:55 PM
Change the width of a single column in a column chart Dave Charts and Charting in Excel 2 December 13th 04 07:25 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 07:57 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"