Handling formulas as values & Ignore blanks - Using array to consolidate data

MurdochQuill

Board Regular
Joined
Nov 21, 2020
Messages
84
Office Version
  1. 365
Platform
  1. Windows
Hi,

As title suggests, I'm using an array for data consolidation. I keep erroring when trying to copy columns with any formulas in them... is there any way around this when using this method ?
I would also really like to ignore blanks cells & not bring them into the array.

VBA Code:
Sub Arraycol()

Application.ScreenUpdating = False
    'Loop through worksheets, put the values in column F into arr array
Dim arr(1 To 10000), cnt As Integer, i As Integer
cnt = 0

For Each ws In Worksheets
    If ws.Name <> "Stitcher" Then
        For i = 1 To ws.Cells(rows.Count, "F").End(xlUp).Row
            cnt = cnt + 1
            arr(cnt) = ws.Cells(i, "F").Value
        Next i
    End If
Next ws

    'Loop through arr array, populate value into Stitcher sheet, column A
For i = 1 To cnt
    ThisWorkbook.Sheets("Stitcher").Cells(i, "A") = arr(i)
Next i

Application.ScreenUpdating = True
End Sub

Any help is appreciated!
 
Very difficult to tell as your code cannot work & you haven't said what you are trying to do.
Line 14, we are running through each sheet in colsheets.
I would like to run through each sheet on colsheets in a different workbook with a different name, as I want to pull an array from another workbook, then paste it in this workbook, or "tb".
 
Upvote 0

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
In that case when you add the sheets to the collection, make sure they are qualified with the workbook name.
 
Upvote 0

Forum statistics

Threads
1,223,905
Messages
6,175,297
Members
452,633
Latest member
DougMo

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