Cell extract

Copper Contributor

I have got a table like it is shown in a picture. I want to extract cells in a new table where the id of the column and id of the row is equally ( in this case id_row=100 and id_column=100). 

4.PNG

2 Replies

@maloks 

Hi, 

use this macro from my vba-tanker to do it

 

Sub TransferData()
Dim lngRow As Long
Dim lngRowMax As Long
Dim rngFind As Range
Dim lngZ As Long

lngZ = 1
With Sheet1
lngRowMax = .Range("A" & .Rows.Count).End(xlUp).Row

For lngRow = 2 To lngRowMax

Set rngFind = Sheet1.Rows(1).Find(what:=.Range("A" & lngRow).Value, lookat:=xlWhole)
If Not rngFind Is Nothing Then
Sheet2.Cells(lngZ, 1).Value = .Range("A" & lngRow).Value
Sheet2.Cells(lngZ, 2).Value = .Cells(lngRow, rngFind.Column).Value
lngZ = lngZ + 1
End If

Next lngRow

End With

End Sub

 

regards

Bernd

www.vba-tanker.com

@maloks , it could be done in few steps with Power Query as attached