Hi,
I already got help creating this code, but I need to make change. I don't fully understand how the code works, but I will try to explain.
I have a list of lifts with unique serial numbers, these lifts are linked to their current location or address.
When the lifts are moved I will type in the new address and I want to move it to, push my button which executing the code that will change the address in my list.
The current code changes the address and it makes a 'previous address' in the Kommentar field. When I move the lift the 'previous' field would only get longer and longer. I would like it only to change the current address to the new one and not to make the previous
The code I used goes like this: (Filename: Pakkeliste Gedatest4 modified v0)
Sub Email_Sheet_Click()
Dim objOutlook As Object
Dim objMail As Object
Dim signature As String
Dim oWB As Workbook
Dim PDF_Filename As String
Dim pakkeListe As Range
Set oWB = ActiveWorkbook
Dim SerNum As Range
Set SerNum = Worksheets("Alleheiserriktig").Range("B4:B100")
For Each Cell In SerNum
If Cell.Value = ActiveSheet.Range("B10").Value Then
Cell.Offset(0, 8) = "Tidligere @ " & Cell.Offset(0, 2) & "; " & Cell.Offset(0, 8) ' + adresse> Kommentar
Cell.Offset(0, 2) = ActiveSheet.Range("D9") ' > addresse
End If
Next Cell
Set pakkeListe = Range("A4:B49")
pakkeListe.ExportAsFixedFormat Type:=xlTypePDF, Filename:="https:\\brendstil.sharepoint.com\Server\Stillas\Maler\Pakkelister\Gedapakkelister\" & Range("D9") & "," & Range("A10") & "," & Range("B10")
PDF_File = "https:\\brendstil.sharepoint.com\Server\Stillas\Maler\Pakkelister\Gedapakkelister\" & Range("D9") & "," & Range("A10") & "," & Range("B10") & ".pdf"
Set objOutlook = CreateObject("Outlook.Application")
Set objMail = objOutlook.CreateItem(0)
With objMail
.Display
End With
signature = objMail.HTMLbody
With objMail
.To = ActiveSheet.Range("C80")
.Cc = ActiveSheet.Range("C80")
.Subject = "Pakkeliste heis"
.HTMLbody = "<font face=" & Chr(34) & "Calibri" & Chr(34) & " size=" & Chr(34) & 4 & Chr(34) & ">" & "Hei," & "<br> <br>" & "Fancy shcmanzy liste" & "<br> <br>" & signature & "</font>"
.Attachments.Add PDF_File
.Save
.Display
End With
Set objOutlook = Nothing
Set objMail = Nothing
End Sub
Sub FindSerial()
Dim SerNum As Range
End Sub
______________________________________
I have changed the code a bit because i'm now saving the PDF file to 2 separate folders. (filename: Pakkeliste Geda ny, Module5)So this is the current code. I would like to implement the code above in the bold text, but without the comment section-autofill. The kommentar fields will be manually filled.