Arijeet
06-15-2010, 02:56 PM
I have an two dimensional array in which some of the top rows and some of the columns on the left are spaces. I want to remove these blank spaces.
'Code
NRows = GetNumberofRows(TestRng:=Range(Cells(1, 1), Cells.SpecialCells(xlCellTypeLastCell)))
NCols = GetNumberofColumns(TestRng:=Range(Cells(1, 1), Cells.SpecialCells(xlCellTypeLastCell)))
ReDim arr(1 To NRows, 1 To NCols)
For i = 1 To NRows
For j = 1 To NCols
arr(i, j) = TestRng.Cells(i, j)
Next
Next
Here arr contains all cells from (1,1) till last valued cell. In this some of the top rows and columns on the left might be empty and I wish to remove them and Redimension the array and remove the blank rows and columns. Need help please.
'Code
NRows = GetNumberofRows(TestRng:=Range(Cells(1, 1), Cells.SpecialCells(xlCellTypeLastCell)))
NCols = GetNumberofColumns(TestRng:=Range(Cells(1, 1), Cells.SpecialCells(xlCellTypeLastCell)))
ReDim arr(1 To NRows, 1 To NCols)
For i = 1 To NRows
For j = 1 To NCols
arr(i, j) = TestRng.Cells(i, j)
Next
Next
Here arr contains all cells from (1,1) till last valued cell. In this some of the top rows and columns on the left might be empty and I wish to remove them and Redimension the array and remove the blank rows and columns. Need help please.