I have sets of data in excel which is to be arrange or transpose the row data after every blank in column A.
I got a code before and its actually perfect. The problem is that it will only search numbers in a column but if the cell is with letters the code will have an error.
Example 1: Column A with numbers only (OKAY)
Sheet1:enter image description hereSheet2: RESULT PERFECTenter image description here
Example 2: Column A with letters and numbers (NOW WITH ERROR)Sheet1:enter image description hereERROR Message:enter image description here
And this is the code that needs revision that can bear both letters and numbers.
Sub Arrange()Dim mA As Long, nA As Long, mB As Long, nB As Long, idx As LongDim eRow As Long, eCol As LongDim LastCell As RangeDim wsA As Worksheet, wsB As WorksheetSet wsA = ActiveWorkbook.Sheets("Sheet1")Set wsB = ActiveWorkbook.Sheets("Sheet2")Set LastCell = wsA.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious)eRow = LastCell.RoweCol = LastCell.ColumnFor mA = 1 To eRow If Not wsA.Cells(mA, 1) = 0 Then idx = wsA.Cells(mA, 1) nB = 0 End If For nA = 1 To eCol If Not mB = idx Then mB = mB + 1 If Not Len(wsA.Cells(mA, nA)) = 0 Then If mB = idx Then nB = nB + 1 wsB.Cells(mB, nB) = wsA.Cells(mA, nA) End If NextNextEnd Sub
Thanks!