ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   what type of variable is this? (https://www.excelbanter.com/excel-programming/438209-what-type-variable.html)

Robert Crandal

what type of variable is this?
 
I am currently writing code in my Worksheet_Change()
as follows:

Private Sub Worksheet_Change (ByVal Target as Range)
For Each t in Target
' Do stuff
Next
End Sub


If I decide to use "Option Explicit" in this module, I believe
that the compiler will ask me to declare the variable "t"
above. What type should I declare "t"?? Should it
be "Dim t as Range"??? or "Dim t as Variant"??? or
something else?


thank u


Rick Rothstein

what type of variable is this?
 
You would Dim it as a Range.

--
Rick (MVP - Excel)


"Robert Crandal" wrote in message
...
I am currently writing code in my Worksheet_Change()
as follows:

Private Sub Worksheet_Change (ByVal Target as Range)
For Each t in Target
' Do stuff
Next
End Sub


If I decide to use "Option Explicit" in this module, I believe
that the compiler will ask me to declare the variable "t"
above. What type should I declare "t"?? Should it
be "Dim t as Range"??? or "Dim t as Variant"??? or
something else?


thank u




All times are GMT +1. The time now is 10:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com