Hello
I dont know of a way to run a worksheet change event like this, though
there shouldnt erealy be a need just create a sub and call that.
hope this makes sence.
Code:
--------------------
Option Explicit
'Dim will keep it private (only within the module of sheet level)
Dim Target
Dim RowsEnd As Long
'public will allow you to use the in other workbooks)
'Public Target
'Public RowsEnd As Long
'#####[In "ThisWorkbook"]
'Private Sub Workbook_Open():'changed out for testing
Sub Test()
With Sheets(1)
RowsEnd = Cells(.Rows.Count, "E").End(xlUp).Row
Target = "D27:F" & (RowsEnd + 25)
End With
'dont run the worksheet event run the sub (i dont think you can call a worksheet event, good chance i could be wrong)
SubOne
'or if the sub is located within a sheet (note will not work with native events)
Sheet1.SubTwo
End Sub
Sub SubOne()
Dim n As Long
With Sheets("Sheet1")
For n = 2 To RowsEnd
.Cells(n, 5) = .cell((n - 1), 5) + .cell(n, 6) - .cell(n, 4)
Next n
End With
End Sub
'### WorkSheet Code
Private Sub Worksheet_Change(Target As Range)
SubTwo
End Sub
Sub SubTwo()
Cells(1, 2).Value = "New Value"
End Sub
--------------------
cheers
--
D_Rennie
------------------------------------------------------------------------
D_Rennie's Profile: 1412
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=172761
Microsoft Office Help