Struggling with this error - I'm not too familiar with object oriented programming so I might just be messing up the syntax or something. I've simplified my code down to show only what seems to be causing the problem and the related variables:
Type layer
Step As Variant
End Type
Sub PullData()
j = 6
Do While a <= j
steps(1, a) = Sheets("Sheet2").Range("B" & a)
a = a + 1
Loop
a = 1
For a = 1 To j
If steps(1, a) = 0
layer.Step = steps(1, a)
'From here there is a bunch of code where I use that value to copy a
'bunch of other values in the worksheet and paste into a different one,
'then move onto the next "item" in the array
Next a
End Sub
Basically what I'm trying to do is take a range of data from a worksheet, convert that range into a one dimensional array, and then set layer.Step equal each of those values through each iteration. The error is happening at layer.Step = steps(1, a) in the second loop.
layerin your subroutine. If you putDim layer as layerat the beginning of thePullDatasubroutine, do you still get the error? I'd recommend naming the variable something else, so you haveDim myLayer as layerand thenmyLayer.Step = steps(1,a)to help with the confusion.