Hi Jindon your code is working . But I still have some concern. If you will see I have two existing rows with data.
The procedure will be like:
1. duplicate the two original data from the two rows. therefore it will have 4 rows , 2 or the first row and 2 for the second row.
2. after duplicate I want to change only the Thickness and width of the newly added rows which the data is from ProfileType Column.
it means my sheet will provide 4 different thickness and width data . the two original data as untouched and two added width and thickness data for newly added.
below is my added snapshot and code:
Untitled.jpg
Private Sub CommandButton1_Click()
Dim x As Long
For x = ActiveSheet.UsedRange.Rows.CountLarge To 1 Step -1
If Cells(x, "D") = "LB" Then
Cells(x, "D") = "ComP"
Cells(x + 1, "D").EntireRow.Insert
Cells(x, "D").EntireRow.Copy Cells(x + 1, "D").EntireRow
End If
Next x
Dim i As Long
With CreateObject("VBScript.RegExp")
.Pattern = "X(\d+(\.\d+)?)X.*?/(\d+(\.\d+)?)$"
For i = 2 To Range("e" & Rows.Count).End(xlUp).Row Step 1
Cells(i, "g").Value = .Execute(Cells(i, "e").Value)(0).submatches(0)
Cells(i, "f").Value = .Execute(Cells(i, "e").Value)(0).submatches(2)
Next
End With
End Sub
Bookmarks