I would do but I dont know how to tailor it to my situation. I have a user form to input data. When I press submit the data from the userform populates certain cells within a range. with regards to the code on ron de bruin's page, how would I incorporate that into the code I have for the Submit button? Code below.
Private Sub cmdSubmit_Click()
ActiveWorkbook.Sheets("Sheet 1").Activate
Range("C1").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = txt1.Value
ActiveCell.Offset(0, 1) = txt2.Value
ActiveCell.Offset(0, 2) = txt3.Value
ActiveCell.Offset(0, 3) = txt4.Value
ActiveCell.Offset(0, 4) = txt5.Value
ActiveCell.Offset(0, 5) = txt6.Value
ActiveCell.Offset(0, 6) = txt7.Value
ActiveCell.Offset(0, 7) = txt8.Value
With Sheets("Sheet 1").PageSetup
.PrintArea = "B2:G8"
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Sheets("Sheet 1").PrintOut
ActiveSheet.Range("B2:G8").Select
ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope
.Introduction = "Weekly Table Figures"
.Item.To = "[email protected]"
.Item.Subject = "Table No"
.Item.Send
End With
ActiveWorkbook.Sheets("Sheet 1").Activate
Range("A1").Select
Unload Me
End Sub
Ron's code is for attaching the range as a workbook. In my situation, I am unable to send .xls documents.
Bookmarks