crusaderAG07
New Member
- Joined
- Jun 20, 2023
- Messages
- 2
- Office Version
- 2016
- Platform
- Windows
Did a search in the forums and only found older threads that had already been answered but looking for help regarding combining data from multiple sheets into one for an upload process.
Background on my workbook. Each worksheet is exactly the same except for the department and the data. I've included the VBA that I set up for one sheet.
The first 4 lines of code are what I want to happen for every sheet and then pasted on the Master sheet in the next available cell of Data in column A. The rest of the data is just "formatting" code that can be ignored for the purpose of this question.
Sub Upload()
Sheets("9208 Administration").Range("A10:B444").Copy
Sheets("Master").Range("A1").PasteSpecial Paste:=xlPasteValues
Sheets("9208 Administration").Range("U10:AF442").Copy
Sheets("Master").Range("C1").PasteSpecial Paste:=xlPasteValues
Dim lRow As Long
Dim iCntr As Long
lRow = 435
For iCntr = lRow To 1 Step -1
If Trim(Cells(iCntr, 1)) = "" Then
Rows(iCntr).Delete
End If
Next
Columns("A:A").Select
Selection.Insert Shift:=xlToRight
Sheets("9208 Administration").Range("C9:C9").Copy
Sheets("Master").Range("A1:A" & Cells(Rows.Count, "B").End(xlUp).Row).PasteSpecial Paste:=xlPasteValues
Columns("D:D").Select
Selection.Insert Shift:=xlToRight
Range("D1").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "Global_Status"
Range("D1").Copy
Sheets("Master").Range("D1:D" & Cells(Rows.Count, "C").End(xlUp).Row).PasteSpecial Paste:=xlPasteValues
Columns("E:E").Select
Selection.Insert Shift:=xlToRight
Range("E1").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "Global_Class"
Range("E1").Copy
Sheets("Master").Range("E1:E" & Cells(Rows.Count, "D").End(xlUp).Row).PasteSpecial Paste:=xlPasteValues
Columns("A:Q").Select
Columns("A:Q").EntireColumn.AutoFit
End Sub
Background on my workbook. Each worksheet is exactly the same except for the department and the data. I've included the VBA that I set up for one sheet.
The first 4 lines of code are what I want to happen for every sheet and then pasted on the Master sheet in the next available cell of Data in column A. The rest of the data is just "formatting" code that can be ignored for the purpose of this question.
Sub Upload()
Sheets("9208 Administration").Range("A10:B444").Copy
Sheets("Master").Range("A1").PasteSpecial Paste:=xlPasteValues
Sheets("9208 Administration").Range("U10:AF442").Copy
Sheets("Master").Range("C1").PasteSpecial Paste:=xlPasteValues
Dim lRow As Long
Dim iCntr As Long
lRow = 435
For iCntr = lRow To 1 Step -1
If Trim(Cells(iCntr, 1)) = "" Then
Rows(iCntr).Delete
End If
Next
Columns("A:A").Select
Selection.Insert Shift:=xlToRight
Sheets("9208 Administration").Range("C9:C9").Copy
Sheets("Master").Range("A1:A" & Cells(Rows.Count, "B").End(xlUp).Row).PasteSpecial Paste:=xlPasteValues
Columns("D:D").Select
Selection.Insert Shift:=xlToRight
Range("D1").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "Global_Status"
Range("D1").Copy
Sheets("Master").Range("D1:D" & Cells(Rows.Count, "C").End(xlUp).Row).PasteSpecial Paste:=xlPasteValues
Columns("E:E").Select
Selection.Insert Shift:=xlToRight
Range("E1").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "Global_Class"
Range("E1").Copy
Sheets("Master").Range("E1:E" & Cells(Rows.Count, "D").End(xlUp).Row).PasteSpecial Paste:=xlPasteValues
Columns("A:Q").Select
Columns("A:Q").EntireColumn.AutoFit
End Sub