excelvba# How to insert one Row from duplicate row data and fill insert row VBA

im have Problem and i hope u can help me :)

I really confused about this problem, because i dont how i can do that, i search on google and i cant found anything

i just want to insert one row for every duplicate row data/ Table and fill that with something from each duplicate data, u can see image below

Table A --> Table B --> Table C

I Hope u help me With **VBA **

Thankss ;)

Solution

- By changing
`Range("E1")`

to`Range("A1")`

, output table will overwrite the source table.

```
Option Explicit
Sub Demo()
Dim i As Long, j As Long, k As Long
Dim arrData, lastRow As Long
Dim arrRes, RowCnt As Long, ColCnt As Long
Dim rRow As Range, sRow As String, r, rCell as Range
' Load data
lastRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
arrData = ActiveSheet.Range("A1:C" & lastRow).Value
RowCnt = UBound(arrData)
ColCnt = UBound(arrData, 2)
ReDim arrRes(1 To RowCnt * 2, 1 To ColCnt)
k = 1
' Loop through data
For i = LBound(arrData) To RowCnt - 1
For j = 1 To ColCnt
arrRes(k, j) = arrData(i, j)
Next j
k = k + 1
' Add JOB row
If Not arrData(i, ColCnt) = arrData(i + 1, ColCnt) Then
arrRes(k, 1) = "JOB " & arrData(i, ColCnt)
sRow = sRow & "," & k
k = k + 1
End If
Next i
' Write data to sheet
Set rCell = Range("E1")
rCell.Resize(1, ColCnt).EntireColumn.Clear
rCell.Resize(k - 1, ColCnt).Value = arrRes
' Apply color to JOB row
For Each r In Split(Mid(sRow, 2), ",")
If rRow Is Nothing Then
Set rRow = rCell.Offset(r - 1).Resize(1, ColCnt)
Else
Set rRow = Application.Union(rRow, rCell.Offset(r - 1).Resize(1, ColCnt))
End If
Next
If Not rRow Is Nothing Then
rRow.Interior.Color = vbYellow
End If
End Sub
```

- Build vertical summary from Columns with Count
- Excel - Create a Unit Conversion sheet - Multiple links
- update cell when column header matches a list
- Delete text in cell subject to Worksheet_Change
- Counting the number of visible rows after autofilter
- Excel 2007: AVERAGEIF, SUMIF, COUNTIF, MAXIF, MINIF across multiple sheets, multple rows
- Import CSV data from a txt file skipping the first line and adding headers
- Simplifying SumIFs formulas for efficient excel formula
- I'd like to find out how to find the current streak of non-negative numbers in a row of data in Excel
- ValueError: Invalid character found in sheet title
- decrypt excel files
- Excel table search funcion that looks for partial string match
- Combine macros to filter on today's and tomorrow's date
- Converting line breaks to commas in excel sheet using Powershell
- Combinations of numbers arranged side by side as many as a random number (VBA)
- How can I remove ONLY leading and trailing spaces while leaving spaces in between words alone with an excel formula?
- VBA Date as integer
- Sliding Window Auto Increment Range
- Count cells with different conditional ranges
- Turning flattened pivots data into tables -Error tables can't overlap - Excel Vba
- How do I get only a specific part of a cell in Excel or Numbers?
- Calculate the Legendre symbol of two integers in Excel
- Unable to get text wrapping or vertical centering to work with xlsxwriter
- Number stored as text warning in excel using POI
- VBA Excel paste to the columns in regular intervals
- Convert filtered values from formulas to values
- Sorting Dictionary by nested class objects data [VBA]
- Events does not appear when making an Outlook query from Excel
- The script works well when I use MSXML2.XMLHTTP.6.0, but it fails miserably when I switch to MSXML2.serverXMLHTTP.6.0
- How to convert text string (d h m s) to time format in excel