jalrs
Active Member
- Joined
- Apr 6, 2022
- Messages
- 300
- Office Version
- 365
- Platform
- Windows
Hello guys,
Another day, another thread, this time I will be able to explain myself better, hopefully.
So, I have a folder called "prototipo". Inside prototipo I have another folder called "Templates" with all my department templates, and a xlsm file called "STransito" that contains all my Data. (STransito is Located inside prototipo folder if it wasn't clear)
Firstly, I filter the information on "STransito.xlsm" for each department, and send it to the department template, to "Pendentes" sheet, according to this macro: (this example is regarding Apoio SP department)
Now my next step after running the macro is to send this template file as an attachment via e-mail. Question here is, I don't wan't to save the template, so I don´t lose it. In order to perform this next action I need to save a copy of the template with a new name assigned, in another location. Location would be: C:\Users\joafrodrigue\Desktop\prototipo\Difusao\
Assume the copy name as: "ST_atéDDMMAAAA_Apoio SP" where DDMMAAAA is the current day on that day.
Thanks, hope i can get some help, and let me know if i wasn't clear enough. I'd be more than happy to provide a sample with bogus information if needed
Best Regards,
Afonso
Another day, another thread, this time I will be able to explain myself better, hopefully.
So, I have a folder called "prototipo". Inside prototipo I have another folder called "Templates" with all my department templates, and a xlsm file called "STransito" that contains all my Data. (STransito is Located inside prototipo folder if it wasn't clear)
Firstly, I filter the information on "STransito.xlsm" for each department, and send it to the department template, to "Pendentes" sheet, according to this macro: (this example is regarding Apoio SP department)
VBA Code:
Option Explicit
Sub ApoioSP()
Dim wb1 As Workbook, wb2 As Workbook
Dim ws1 As Worksheet, ws2 As Worksheet
Set wb1 = ThisWorkbook
Set wb2 = Workbooks("TApoio SP.xlsx")
Set ws1 = wb1.Worksheets("Stock Trânsito")
Set ws2 = wb2.Worksheets("Pendentes")
ws2.UsedRange.Offset(1).ClearContents
Dim lr1 As Long, lr2 As Long
lr1 = ws1.Cells(Rows.Count, 1).End(3).Row
lr2 = ws2.Cells(Rows.Count, 1).End(3).Row + 1
With ws1.Range("A5:AV" & lr1)
.AutoFilter 46, "Apoio SP"
.AutoFilter 47, "Em tratamento"
.Offset(1).Copy ws2.Cells(lr2, 1)
With ws1.Range("BH6:BH" & lr1)
.Copy ws2.Cells(2, 49)
End With
.AutoFilter
End With
lr2 = ws2.Cells.Find("*", , xlFormulas, , 1, 2).Row + 1
ws2.Range("A" & lr2 & ":A1001").EntireRow.Delete
End Sub
Now my next step after running the macro is to send this template file as an attachment via e-mail. Question here is, I don't wan't to save the template, so I don´t lose it. In order to perform this next action I need to save a copy of the template with a new name assigned, in another location. Location would be: C:\Users\joafrodrigue\Desktop\prototipo\Difusao\
Assume the copy name as: "ST_atéDDMMAAAA_Apoio SP" where DDMMAAAA is the current day on that day.
Thanks, hope i can get some help, and let me know if i wasn't clear enough. I'd be more than happy to provide a sample with bogus information if needed
Best Regards,
Afonso