Dim targetRow As Long
Dim offsetRow As Long
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("I2:I5000")) Is Nothing Then
If IsDate(Target.Value) And Target.Value > 0 Then
targetRow = Target.Row
offsetRow = Target.Offset(9, 0).Row
Call something(targetRow, offsetRow)
End If
End If
End Sub
Sub something(a As Long, b As Long)
Debug.Print "This is a " & a & " and " & b
Sub Mail_small_Text_Outlook()
Dim xOutApp As Object
Dim xOutMail As Object
Dim xMailBody As String
Set xOutApp = CreateObject("Outlook.Application")
Set xOutMail = xOutApp.CreateItem(0)
xMailBody = "Szia! Mai napon kilépett az adott munkavállaló :" & vbNewLine & vbNewLine & Range("A2") & vbNewLine & Range("B2")
On Error Resume Next
With xOutMail
.To = "judin.alexander@work-force.hu"
.CC = ""
.BCC = ""
.Subject = "Mai kilépő"
.Body = xMailBody
.Send 'or use .Send
End With
On Error GoTo 0
Set xOutMail = Nothing
Set xOutApp = Nothing
End Sub
Private Sub Worksheet_Change2(ByVal Target As Range)
If Target.Address = "$I$2" Then
Call Mail_small_Text_Outlook
End If
End Sub