Macro for Excel Data Consolidation

bb19august

New Member
Joined
Feb 1, 2019
Messages
18
Can someone help me with creating excel macro for the following.

Data will be entered in the "Main" Worksheet Table. Shown entries for a project with two units - Unit 1 and 2. this could be multiple units.
Project Name"Enter Project Name Here"
Test Date"Enter Test Date here"
Report Name"Enter Test Report Name here"
Unit NameUnit P/NUnit CriticalitySW Version
"Enter Unit1 Name Here""Enter Unit1 P/N Here""Enter Unit1 Criticality Here""Enter Unit1 SW Version here"
"Enter Unit2 Name Here""Enter Unit2
P/N Here"
"Enter Unit2 Criticality Here""Enter Unit2 SW Version here"

<tbody>
</tbody>

A click option (Button or a cell with "Click here") in the Main worksheet will populate the Project (say P1) data in a different worksheet in the same file (say "Data" worksheet) in the below fashion

Project NameP1
Test Date10/10/2019
Report Name111-11
Unit NameUnit P/NUnit CriticalitySW Version
AA100111A1.0
BB100222B1.2


<tbody>
</tbody>

When a different project (say P2) details are entered and submitted in the Main worksheet, it will insert/add rows to include the data as shown below. Here shown for three units (AA100, BB101, C100). So it could be same unit name(AA100) or a new unit name (BB101, C100). Same unit names to insert rows below the same names and data populated. New unit names adds data below the last entered column as shown below.

Project NameP1P2
Test Date10/10/201910/22/2019
Report Name111-11111-12
Unit NameUnit P/NUnit CriticalitySW VersionSW Version
AA100111A1.0
AA100112A1.11.1
BB100222B2.0
BB101223B2.1
C100100A1.0

<tbody>
</tbody>

It could be helpful if someone could help out. Not sure, If the above description seems confusion. i can try to answer better if there are any clarifications.

Thank you.
BB
 

bb19august

New Member
Joined
Feb 1, 2019
Messages
18
I added a command button (in the Main worksheet) and include the following script. This will copy the contents from one sheet to another based on unit names. However need help with looking up this unit list from a table with unit names predefined.
Also help with inserting rows in between when same units are entered in the main sheet, rather than copying to the last blank row.

Private Sub CommandButton1_Click()
a = Worksheets("Main").Cells(Rows.Count, 1).End(xlUp).Row
For i = 5 To a
Worksheets("Main").Cells(i, 1).Value = "AA100" Or Worksheets("Main).Cells(i, 1).Value = "BB100" Or Worksheets("Main).Cells(i, 1).Value = "BB101" Or Worksheets("Main).Cells(i, 1).Value = "C100" Then
Worksheets("Main").Rows(i).Copy
Worksheets("Data").Activate
b = Worksheets("Data").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("Data").Cells(b + 1, 1).Select
ActiveSheet.Paste
Worksheets("Main").Activate
End If
Next
Application.CutCopyMode = False
ThisWorkbook.Worksheets("Main").Cells(1, 1).Select


End Sub
 

Forum statistics

Threads
1,085,587
Messages
5,384,610
Members
401,913
Latest member
chethan av

Some videos you may like

This Week's Hot Topics

Top