View Single Post
 
Old 10-06-2020, 09:01 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,980
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

You are creating variables without defining what type of data they are. If you define their types, you will be able to more easily spot the errors in your code. Looking at the first time the variables are assigned values, I would deduce the following types.

Dim i as Integer, j as Integer, p as Integer, q as Row

However, you then test q as if it is a number. I expect that would cause the Run-time error you encountered.

Then with the variable arr, you populate it as a Range and then use UBound on it as if it is an array. This might work in Excel's vba but I would not be surprised if it didn't.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote