I am new to VBA and trying to solve a problem in VBA Excel. I am using "Option Explicit". Every time I run code in VBA a compile error appears. It says "variable not defined". How a variable is defined in VBA?
You are getting that error because your variable is not declared and you have used Option Explicit at the top which forces you to declare your variables as a specific data type. You may want to read up about it in To ‘Err’ is Human. See Point #2. Also when working with Excel rows, it is better to declare them as Long rather than Integer else you may get Overflow error.
Option Explicitat the top which forces you to declare your variables as a specific data type. You may want to read up about it in To ‘Err’ is Human. See Point #2. Also when working with Excel rows, it is better to declare them asLongrather thanIntegerelse you may getOverflowerror.