I am trying to automate copying and sending emails. However I get an error on line (sh.Range("A1:D200" & lr).Select
) if I change the 200 to 50 it works but with 200 it does not work. The error I get is 1004 out of range
.
Option Explicit
Sub Send_Email_With_snapshotDyka()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Dyka PVC")
Dim lr As Integer
lr = sh.Range("A" & Application.Rows.Count).End(xlUp).Row
sh.Range("A1:D200" & lr).Select
With Selection.Parent.MailEnvelope.Item
.to = sh.Range("H3").Value
.Subject = sh.Range("H4").Value
.send
End With
MsgBox "done"
End Sub