# What does this do?? .Resize(UBound(b, 2), UBound(b, 1))

#### BBQKING3

##### Board Regular

I keep getting an error when I run a macro with this in it.

What does it do and how do I debug it??

.Resize(UBound(b, 2), UBound(b, 1)) _
= Application.Transpose(b)

Can someone demystify this for me

### Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Can't really help without seeing more of the code.

What is b? What error are you getting?

What is the code actually supposed to do?

It resizes a range to the upper bounds of a two-dimensional array and fills the range with the contents of the array.

To get more help you will have to post the code that crates the array.

Dim a, i As Long, n As Long
a = Sheets("Queries_2").Range("a1").CurrentRegion _
.Resize(, 3).Value
ReDim b(1 To 3, 1 To 1)
For i = 1 To 3
b(i, 1) = a(1, i)
Next
For i = 2 To UBound(a, 1)
If IsNumeric(a(i, 3)) And a(i, 3) > 0 Then
n = UBound(b, 2) + 1
ReDim Preserve b(1 To 3, 1 To n + a(i, 3) - 1)
For ii = n To n + a(i, 3) - 1
For iii = 1 To 3
b(iii, ii) = a(i, iii)
If iii = 3 Then b(iii, ii) = 1
Next
Next
End If
Next
With Sheets("Queries_2").Range("e1")
.CurrentRegion.ClearContents
.Resize(UBound(b, 2), UBound(b, 1)) _
= Application.Transpose(b)
End With
Erase a, b

Replies
7
Views
298
Replies
0
Views
166
Replies
0
Views
147
Replies
3
Views
136
Replies
1
Views
172

1,203,502
Messages
6,055,772
Members
444,822
Latest member
Hombre

### 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.

### Which adblocker are you using?

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

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