Hi everyone,

I want to ask for your opinion. Below there are two sub procedures. Both does the samething. Only difference is the declaration of the variables. Does it matter if I declare a variable on the fly or is it more appropriate to declare all variables at the beginning?



Method1
Code:
Sub Main()
  Dim str_Data As String
  str_Data = "Method1"
  MsgBox str_Data

  Dim int_X As Integer
  int_X = 1
  MsgBox int_X
End Sub
Method2
Code:
Sub Main()
  Dim str_Data As String
  Dim int_X As Integer
  
  str_Data = "Method2"
  MsgBox str_Data
  
  int_X = 1
  MsgBox int_X
End Sub