ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   second worksheet change (https://www.excelbanter.com/excel-programming/345258-second-worksheet-change.html)

tina

second worksheet change
 
Hi
Is it possible to have ore than one private sub worksheet_change?
I have written following code
Private Sub Worksheet_Change(ByVal Target As Range)

If Not Application.Intersect(Range("a1:a100"), Target) Is Nothing Then
ActiveCell.Offset(0, 4).Select
Else
End If
End Sub
which works fine but I would also like to select activecell.offset(0,2)
when target range is ("e1:e100")
The reason being one value entered into cell in first range("a1:a100") tabs
to column E then I would like after value entered in this cell tab to column G
Hope this makes sense
Thanks in advance for any ideas
Tina


Toppers

second worksheet change
 
Tina,
This will do what you want - you can do multiple tests for
insersection in the one routine.


Private Sub Worksheet_Change(ByVal Target As Range)

If Not Application.Intersect(Range("a1:a100"), Target) Is Nothing Then
ActiveCell.Offset(0, 4).Select
Else
If Not Application.Intersect(Range("E1:E100"), Target) Is Nothing Then
ActiveCell.Offset(0, 2).Select
End If
End If
End Sub

HTH

"tina" wrote:

Hi
Is it possible to have ore than one private sub worksheet_change?
I have written following code
Private Sub Worksheet_Change(ByVal Target As Range)

If Not Application.Intersect(Range("a1:a100"), Target) Is Nothing Then
ActiveCell.Offset(0, 4).Select
Else
End If
End Sub
which works fine but I would also like to select activecell.offset(0,2)
when target range is ("e1:e100")
The reason being one value entered into cell in first range("a1:a100") tabs
to column E then I would like after value entered in this cell tab to column G
Hope this makes sense
Thanks in advance for any ideas
Tina


Tom Ogilvy

second worksheet change
 
Private Sub Worksheet_Change(ByVal Target As Range)

If Not Application.Intersect(Range("a1:a100"), Target) Is Nothing Then
Target.Offset(0, 4).Select
Elseif Not Application.Intersect(Range("E1:E100"),Target) is Nothing then
Target.Offset(0,2).Select
End If
End Sub



--
Regards,
Tom Ogilvy

"tina" wrote in message
...
Hi
Is it possible to have ore than one private sub worksheet_change?
I have written following code
Private Sub Worksheet_Change(ByVal Target As Range)

If Not Application.Intersect(Range("a1:a100"), Target) Is Nothing Then
ActiveCell.Offset(0, 4).Select
Else
End If
End Sub
which works fine but I would also like to select activecell.offset(0,2)
when target range is ("e1:e100")
The reason being one value entered into cell in first range("a1:a100")

tabs
to column E then I would like after value entered in this cell tab to

column G
Hope this makes sense
Thanks in advance for any ideas
Tina





All times are GMT +1. The time now is 07:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com