I'm trying to send emails of tables inside each sheet to recipients. I've got everything working except for making the range dynamic (to last cell).
I want to send data from cell A1
to last cell in Column G
. I'm not having any luck making it work. The part below is an excerpt of the code which contains the ill formed range. Any help is much appreciated.
Sub Email1()
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
Set rng = Nothing
On Error Resume Next
Set rng = Sheets("Rec1").Range("A1", Range("A1").End(xlDown)).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If rng Is Nothing Then
MsgBox "The selection is not a range or the sheet is protected" & _
vbNewLine & "please correct and try again.", vbOKOnly
Exit Sub
End If