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

MurdochQuill

Board Regular
Joined
Nov 21, 2020
Messages
74
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!
 

MurdochQuill

Board Regular
Joined
Nov 21, 2020
Messages
74
Office Version
  1. 365
Platform
  1. Windows
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".
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
62,383
Office Version
  1. 365
Platform
  1. Windows
In that case when you add the sheets to the collection, make sure they are qualified with the workbook name.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
62,383
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Forum statistics

Threads
1,141,299
Messages
5,705,571
Members
421,399
Latest member
hjweiss00

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
Top