I currently have a macro that loops through all each column on a sheet. Within that loop it will find the value of the column header and row header. It then will find that column header value in a table on a different sheet. The next point of the macro should look for the original row header value and return the row number, but I seem to be getting caught up in using the returned column number as a column reference number in the remainder of the code. Any ideas?
Code:
Sub Macro3()
Dim r As Long
Dim c As Long
Dim cols As Range
Dim rows As Range
Dim colmatch As Long
Dim rowcheck As Range
Dim rowmatch As Long
Dim rFind As Range
For c = 2 To 245 Step 1
For r = 2 To 611 Step 1
colhead = Cells(1, c).Value
rowhead = Cells(r, 1).Value
On Error Resume Next
colmatch = WorksheetFunction.Match(colhead, Sheets("usethis").Range("A1:FDX1"), 0)
Set rowcheck = Sheets("usethis").Range(Cells(2, colmatch), Cells(3821, colmatch))
rowmatch = WorksheetFunction.Match(rowhead, rowcheck, 0)
If rowmatch = 0 Then
Cells(r, c).Value = "-"
Else
Cells(r, c).Value = Sheets("usethis").Cells(rowmatch, colmatch).Value
End If
Next r
Next c
End Sub