Hi Everyone this is my first post! I have a spreadsheet with about 6 tabs with different matricies. On my last tab I would like to be able to select a matrix and then convert it into a 3 column list.
ex. a b c d e f g
.....A B C D E F G
a A 1 2 3 4 5 6
b B 1 2 3 4 5 6
c C 1 2 3 4 5 6 and so on. Then transfer it into:
A A 1
A B 2
A C 3...with all the options but I dont want it to include the lowercase sub-names
Here is my code so far. I stoped afterthe first tab because I could not get to work. I think the subnames are whats messing with the code.
Sub Matrixchange1()
Dim pagdir As Variant
Dim snpa As String
pagdir = Range("E2").Value 'this cell changes depending on chosen matrix
If pagdir = "Tab" Then
snpa = "Tab"
ActiveWorkbook.Sheets(snpa).Activate 'Page inwhich indicating matrix option
sn = Cells(3, 3).CurrentRegion 'Where matrix starts
For j = 2 To UBound(sn)
For jj = 2 To UBound(sn, 2)
c01 = c01 & vbCr & sn(j, 1) & "|" & sn(1, jj) & "|" & sn(j, jj) 'How far away data is from title data
Next
Next
sn = Split(Mid(c01, 2), vbCr)
Cells(1, 102).Resize(UBound(sn)) = Application.Transpose(sn) 'Identifying where list is placed
Columns(102).TextToColumns , , , , False, False, False, False, True, "|"
End If
If pagdir = "Tab_1" Then
snpa = "Tab 1"
End If
If pagdir = "Tab_2" Then
snpa = "Tab 2"
End If
If pagdir = "Tab_3" Then
snpa = "Tab 3"
End If
If pagdir = "Tab_4" Then
snpa = "Tab 4"
End If
End Sub
I would be very grateful if someone could help. Ive been working on this for weeks and cant figure it out.
Thanks!
Bookmarks