What I thought would be the easiest part of this project is the hardest.
I have a request form in Excel and a Macro built in I created that sends a snippet of the requested items and attaches the workbook in an email before automatically saving and closing the workbook.
I want the email to attach the edited workbook with the added details. This works. What I want to happen next (after sending and before saving/closing) is to delete the name columns, location, etc. and reduce the "requested QTY" from the "Available Qty". Any help is much appreciated, I'm not really sure where to begin.
End of code and reference image below: (sending email works as does saving and closing the file)
Set objEmail = ObjOutlook.CreateItem(olMailItem)
With objEmail
.Importance = 2
.To = "[email protected];[email protected]"
.Subject = strSubject
.htmlBody = strHTML
.Attachments.Add wb.FullName
.Send
End With
Range("Table1[QTY Requested]").Select
Selection.ClearContents
Range("Table1[[SOS Project Manager]:[Notes]]").Select
Selection.ClearContents
ThisWorkbook.Save
ThisWorkbook.Close
End Sub
I tried the below to just clear the contents. This of course doesn't address adjusting the "available QTY" to it's new respective number.
Range("Table1[QTY Requested]").Select
Selection.ClearContents
Range("Table1[[SOS Project Manager]:[Notes]]").Select
Selection.ClearContents
Microsoft documentation:
Range("Table1[QTY Requested]").Copy
Range("Table1[Available QTY]").PasteSpecial Paste:=xlPasteValues, _
Operation:=xlSubtract, SkipBlanks:=False, Transpose:=False
Range("Table1[QTY Requested]").ClearContents
Range("Table1[[SOS Project Manager]:[Notes]]").ClearContents