- Lag en ny arbeidsbok med markeringen.
- Lagre arbeidsboken før du sender den.
- Slett filen fra harddisken etter at den er sendt.
Det vil vise skjulte rader og kolonner i utvalget
Alle tomme celler utenfor valget er skjult (se skjermbilde)
På denne måten er utvalget alltid øverst på arket
Sub Mail_Selection () Dim strDate As String Dim Addr As String Dim rng As Range If ActiveWindow.SelectedSheets.Count> 1 Eller Selection.Areas.Count> 1 Avslutt deretter Sub Application.ScreenUpdating = False Addr = Selection.Address ActiveSheet.Copy ActiveSheet. Pictures.Delete With Cells .EntireColumn.Hidden = False .EntireRow.Hidden = False End With Range (Addr) .Velg Set rng = Selection Application.GoTo rng, True With rng.EntireColumn .Hidden = True rng (1) .EntireRow. SpecialCells (xlVisible) .EntireColumn.Clear rng (1) .EntireRow.SpecialCells (xlVisible) .EntireColumn.Hidden = True .Hidden = False End With With rng.EntireRow .Hidden = True rng (1) .EntireColumn.SpecialCells () .EntireRow.Clear rng (1) .EntireColumn.SpecialCells (xlVisible) .EntireRow.Hidden = True .Hidden = False End With Application.GoTo rng, True rng.Cells (1) .Velg strDate = Format (Date, "dd- mm-åå ") &" "og format (tid," h-mm-ss ") ActiveWorkbook.SaveAs" Del av "& ThisWorkbook.Name _ &" "& strDate &" .xls "ActiveWorkbook.SendM ail "[email protected]", _ "Dette er emnelinjen" ActiveWorkbook.ChangeFileAccess xlReadOnly Kill ActiveWorkbook.FullName ActiveWorkbook.Close False Application.ScreenUpdating = True End Sub