Delete Empty rows from array

th081

Board Regular
Joined
Mar 26, 2006
Messages
98
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I have a array i have dimensioned as BlkDataNew(1 to x, 1 to 7) with x being a variable.

After my calcs are processed i end up with some rows being blank i.e 1 to 7 is empty, how do i delete all the rows where 1 is empty (if the 1st is blank the rest are).

and once i just have records in the array that have data can i transfer to a worksheet in one swoop or do i have to loop through the array and put each value individually.

Any steer would be very welcome.

Regards

Taz
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
You could use something like
VBA Code:
Sub th()
   Dim Nary As Variant
   Dim r As Long, c As Long, nr As Long
   
   ReDim Nary(1 To UBound(BlkDataNew), 1 To UBound(BlkDataNew, 2))
   For r = 1 To UBound(BlkDataNew)
      If BlkDataNew(r, 1) <> "" Then
         nr = nr + 1
         For c = 1 To UBound(BlkDataNew, 2)
            Nary(nr, c) = BlkDataNew(r, c)
         Next c
      End If
   Next r
   Sheets("Sheet1").Range("A2").Resize(nr, UBound(Nary, 2)).Value = Nary
End Sub
 
Upvote 0
Solution
thank you very much Fluff, much appreciated.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,213,490
Messages
6,113,957
Members
448,535
Latest member
alrossman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top