Sou completamente novo no VBA e sou solicitado a fazer as melhorias em um dia.
Meu código atual cria vários documentos do Excel e possui dados em 'Folha1'. Agora quero que um único excel seja criado, com várias planilhas. Como salvar sheet1s de várias pastas de trabalho criadas em uma única pasta de trabalho com várias planilhas usando scripts VB?
Código:
Dim getLCount As Integer, getPCount As Integer, getTotalCountAdd As Integer
Dim getValidColumnNames As String, getValidColumnNames_p As String, checkCol1 As String, checkCol2 As String
Dim addAllColumns As String
Dim foundFlag As Boolean
Dim splitgetValidColumnNames As Variant, splitgetValidColumnNames_i As Variant, splitgetValidColumnNames_p As Variant, splitgetValidColumnNames_p_i As Variant
getLCount = ColN_cnt
getPCount = getColCount '- 1
Wbook_Input.Activate
Worksheets(tableName).Range("A2:B" & getLCount + 2).Copy Destination:=Workbooks(newWorkbookName).Sheets("Sheet1").Cells(4, "A")
Workbooks(newWorkbookName).Activate
Wbook_Input.Activate
Worksheets(tableName).Range("E2:F" & getPCount + 2).Copy Destination:=Workbooks(newWorkbookName).Sheets("Sheet1").Cells(4, "C")
Workbooks(newWorkbookName).Activate
Worksheets.Add
ActiveSheet.Move After:=Sheets(ActiveWorkbook.Sheets.Count)
ActiveWorkbook.Save
Application.CutCopyMode = False
Worksheets("Sheet1").Select
Worksheets("Sheet1").Range("A5").Select
Tags microsoft-excel macros vba