|
| HOMEPAGE | INDICE FORUM | REGOLAMENTO | ::. | NEI PREFERITI | .:: | RSS Forum | RSS News | NEWS web | NEWS software | |
| PUBBLICITA' | | | ARTICOLI | WIN XP | VISTA | WIN 7 | REGISTRI | SOFTWARE | MANUALI | RECENSIONI | LINUX | HUMOR | HARDWARE | DOWNLOAD | | | CERCA nel FORUM » | |
24-08-2012, 13.02.09 | #1 |
Newbie
Registrato: 24-08-2012
Messaggi: 1
|
Excel, macro, VBA, salvataggi e date
premetto che sono un niubbo di VBA . Vorrei aiuto per soddisfare la mia esigenza. Ho un file xlsx con circa un migliaio di righe che devo splittare in più file distinti secondo regole che si ripetono uguali tutti i mesi. Perciò ho creato la seguente macro Codice:
Sub Crea_file() ' ' Crea_file Macro ' ' Sheets("Analisi").Select ActiveSheet.Range("$A$1:$T$2000").AutoFilter Field:=16, Criteria1:= _ "X-MEN" Range("A1").Select Range(Selection, Selection.End(xlToRight)).Select Range(Selection, Selection.End(xlDown)).Select Selection.Copy Workbooks.Add ActiveSheet.Paste Application.CutCopyMode = False ActiveWorkbook.SaveAs Filename:= _ "C:\...\X-MEN.xlsx" _ , FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False ActiveWindow.Close ActiveSheet.Range("$A$1:$T$2000").AutoFilter Field:=16, Criteria1:= _ "DISNEY" ActiveSheet.Range("$A$1:$S$2000").AutoFilter Field:=17, Criteria1:= _ "PLUTO" Range("A1").Select Range(Selection, Selection.End(xlToRight)).Select Range(Selection, Selection.End(xlDown)).Select Selection.Copy Workbooks.Add ActiveSheet.Paste Application.CutCopyMode = False ActiveWorkbook.SaveAs Filename:= _ "C:\...\PLUTO.xlsx" _ , FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False ActiveWindow.Close ActiveSheet.Range("$A$1:$S$2000").AutoFilter Field:=17, Criteria1:= _ "PIPPO" Range("A1").Select Range(Selection, Selection.End(xlToRight)).Select Range(Selection, Selection.End(xlDown)).Select Selection.Copy Workbooks.Add ActiveSheet.Paste Application.CutCopyMode = False ActiveWorkbook.SaveAs Filename:= _ "C:\...\PIPPO.xlsx" _ , FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False ActiveWindow.Close ActiveSheet.ShowAllData End Sub In sostanza prima filtro sugli X-MEN e creo un file apposta, poi filtro su DISNEY e successivamente sui singoli personaggi (colonna diversa) e creo un file per ciascuno (pippo, pluto, paperino ecc). E fin qui ok, funziona. Però avrei bisogno di aggiungere la data al nome di ciascun file salvato. Ho letto da qualche parte che è possibile farlo, mi spiegate come per cortesia? Vorrei che ciascun file avesse alla fine un _[data odierna]. Tenete presente che il mio file è composto da numerosi fogli, perciò potrei creare un foglio vuoto con la sola data e linkarci la macro, devo solo capire come fare. Spero di essere stato abbastanza chiaro... Grazie mille |
Utenti attualmente attivi che stanno leggendo questa discussione: 1 (0 utenti e 1 ospiti) | |
Strumenti discussione | |
|
|
Discussioni simili | ||||
Discussione | Autore discussione | Forum | Risposte | Ultimo messaggio |
Corso VBA | Alexsandra | Guide | 85 | 16-11-2016 12.11.51 |
EXCEL - Macro per celle selezionate. | riccardonard | Office suite | 4 | 25-11-2008 15.05.35 |
Calcoli con date in Excel | Lionsquid | Office suite | 6 | 19-02-2008 08.27.42 |
Macro Excel | TiTTi | Office suite | 19 | 14-09-2004 20.46.09 |
modifica macro in excel | mag | Software applicativo | 2 | 20-11-2003 11.12.08 |