It tells excel that you're creating a variable. In this case, I declared a
variable as Long (a counting number--no fractions).
Declaring the variables and telling excel that you want to declare variables go
hand in hand.
Option Explict
at the top of the module means that I have to declare all the variables I use.
Then if I did this:
option explicit
sub test()
dim firstrow as long
firstrow = 0
firstrow = fristrow + 1
end sub
wouldn't get close to running. (Fristrow is spelled incorrectly and excel knows
it's not a variable, since I didn't declare it.)
By declaring the variables, it'll make your code easier to debug/maintain.
And you'll even get excel's intellisense to help out.
try this:
Dim wks as worksheet
'then type wks. (with that dot)
wks.
You'll see a list of all the things that you could type next that can be used
with worksheet objects.