Office 365 Excel - Turn cell matrix into list without blanks

-1

I am trying to take a matrix of 2500x2500 cells (95% of the cells are blank) and create a list without any blanks.

Alfred Abercrombie

Posted 2019-09-13T15:28:47.353

Reputation: 1

Answers

0

First enter your data in A1 through CRD2500. Then run this short macro:

Sub MakeAList()
        Dim r As Range, N As Long, cell As Range

        Set r = Range("A1:CRD2500")
        N = 1
        For Each cell In r
            If cell.Value <> "" Then
                Range("CRE" & N).Value = cell.Value
                N = N + 1
            End If
        Next cell
End Sub

The list will appear in column CRE.

Gary's Student

Posted 2019-09-13T15:28:47.353

Reputation: 15 540

Unless there are >=84% blanks, this will crash. Yes, I know the OP specified 95%. – Jeeped – 2019-09-13T21:36:40.783