Ranges with split rows combined into array issue

Darren Smith

Active Member
Joined
Nov 23, 2020
Messages
496
Office Version
  1. 2019
Platform
  1. Windows
The code below is to combine arrays with a gap between the ranges.
The array does not fill-in?
Says "Arr error 2015" & RunTime Error 13

VBA Code:
Private Sub Fill_Details_Click()

TurnOff

Dim wsCSheet As Worksheet, JCM As Worksheet
Dim Col As Long, Row As Long
Dim Arr As Variant
Dim A As Integer, B As Integer

    Set JCM = ThisWorkbook.Worksheets("Job Card Master")

      Dim rngItem As Range: Set rngItem = JCM.Range("A13:A61,A66:A122")
       Dim rngDes As Range: Set rngDes = JCM.Range("C13:C61,C66:C122")
        Dim rngAllocHrs As Range: Set rngAllocHrs = JCM.Range("K1:K61,K66,K122")

    Set wsCSheet = ThisWorkbook.Worksheets("Check Sheet")


Dim RngAll As Range: Set RngAll = Union(rngItem, rngDes, rngAllocHrs)
            Arr = Application.Transpose(RngAll)

For Col = LBound(Arr) To UBound(Arr)
  For Row = LBound(Arr, 13) To UBound(Arr, 13)
  Next
    Next
  End If

  B = 12
For A = 12 To Arr

    If JCM.Cells(A, 1) <> "" Then
        Do Until Worksheets("Check Sheet").Cells(B, 2) = ""
        B = B + 1
        Loop
        wsCSheet.Cells(B, 1) = JCM.Cells(A, 1): wsCSheet.Cells(B, 2) = JCM.Cells(A, 3): wsCSheet.Cells(B, 6) = JCM.Cells(A, 11)
    End If
   
Next A

End sub
 
Last edited:

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

StephenCrump

MrExcel MVP
Joined
Sep 18, 2013
Messages
4,163
Office Version
  1. 365
Platform
  1. Windows
The code you've posted doesn't make much sense, and doesn't even compile (you've got a superfluous Endif).

What do you want the code to do? It looks like you want to rearrange some input ranges into some other format? If so, perhaps you could show:

a) input, and
b) desired output?
 

Watch MrExcel Video

Forum statistics

Threads
1,133,828
Messages
5,661,160
Members
418,619
Latest member
ibruzzi

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