Hi,everybody
In each row first cell should match with the same row's rest cells.And the result should be in the page 2 as in the sample.match.xlsx
Hi,everybody
In each row first cell should match with the same row's rest cells.And the result should be in the page 2 as in the sample.match.xlsx
Hi there,
maybe Your task can be done in shorter variation, but following code should work:
Hope it helps![]()
Option Explicit Sub CopyToNextSheet() Dim Sht1, Sht2 As Worksheet Dim PosCount As Integer Dim Row1 As Integer: Row1 = 1 Dim Row2 As Integer Set Sht1 = Sheets("Sayfa1") Set Sht2 = Sheets("Sayfa2") Do Until Sht1.Cells(Row1, 1) = "" PosCount = WorksheetFunction.CountA(Sht1.Rows(Row1)) - 1 Select Case Sht2.Cells(1, 2) Case Is = vbNullString Row2 = 1 Case Is >= 1 Row2 = Sht2.UsedRange.Rows.Count + 1 End Select If PosCount > 0 Then Sht2.Cells(Row2, 2).Resize(PosCount) = Sht1.Cells(Row1, 1) Sht1.Cells(Row1, 2).Resize(, PosCount).Copy Sht2.Cells(Row2, 1).PasteSpecial Paste:=xlPasteAll, Transpose:=True Else Sht2.Cells(Row2, 2) = Sht1.Cells(Row1, 1) End If Row1 = Row1 + 1 Loop Application.CutCopyMode = False End Sub
Regards
Miroslav R.
(If You like my solutions, feel free to add reputation.)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks