Forum Discussion
Geo-3llen_
Jun 05, 2019Copper Contributor
Automatic duplicate cells by X
I've attached a basic example of the spreadsheet I'm trying to build (as the real version is sensitive material) This is an order form in which one person will paste in the addresses as copied fr...
Berndvbatanker
Jun 05, 2019Iron Contributor
Hi, with help of little macro you can do this..see attached file,
Sub ListOrders()
Dim lngRow As Long
Dim lngRowMax As Long
Dim lngZ As Long
Dim lngzMax As Long
Dim lngFreeRow As Long
With Tabelle2
lngzMax = Tabelle1.Range("A" & Tabelle1.Rows.Count).End(xlUp).Row
lngRowMax = .Range("A" & .Rows.Count).End(xlUp).Row
For lngRow = 2 To lngRowMax
If .Range("B" & lngRow).Value = 1 Then
For lngZ = 2 To lngzMax
lngFreeRow = Tabelle4.Range("A" & Tabelle4.Rows.Count).End(xlUp).Row + 1
Tabelle4.Cells(lngFreeRow, 1).Value = .Range("A" & lngRow).Value
Tabelle4.Cells(lngFreeRow, 2).Value = Tabelle1.Range("A" & lngZ).Value
Tabelle4.Cells(lngFreeRow, 3).Value = Tabelle1.Range("B" & lngZ).Value
Tabelle4.Cells(lngFreeRow, 4).Value = Tabelle1.Range("C" & lngZ).Value
Tabelle4.Cells(lngFreeRow, 5).Value = Tabelle1.Range("D" & lngZ).Value
Tabelle4.Cells(lngFreeRow, 6).Value = Tabelle1.Range("E" & lngZ).Value
Tabelle4.Cells(lngFreeRow, 7).Value = Tabelle1.Range("F" & lngZ).Value
Next lngZ
End If
Next lngRow
End With
End Sub
Regards from germany
Bernd
http://www.vba-Tanker.com