Passing a range between two subroutines.

  • Thread starter Thread starter Philosophaie
  • Start date Start date
P

Philosophaie

Could someone show me where I am going wrong.

[In "ThisWorkbook"]
Private Sub Workbook_Open()
Dim RowsEnd As Double
Dim Target As Range
RowsEnd = Cells(.Rows.Count, "E").End(xlUp).Row

'Not certain if correct
Target = "D27:F" & (RowsEnd + 25)

'Unsure if this will call Worksheet_Change
Worksheet_Change(Target as Range).

End Sub

Private Sub Worksheet_Change(Target as Range)
With Sheets("Sheet4")
For n = 2 To RowsEnd
.Cells(n, 5) = .cell((n - 1), 5) + .cell(n, 6) - .cell(n, 4)
Next n
End With
End Sub
 
I would like to know how to get "Target as Range" to the Worksheet_Change
subroutine from the Workbook_Open.
 
Back
Top