why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multi

D

Daniel

why is it saying sheetcnt is "variable not defined" how to do a global
variable to share over multiple functions in vba for excel?

Dim sheetcnt As Integer
Private Sub cmdImport_Click()
sheetcnt = 1
 
E

Earl Kiosterud

Daniel,

Dimming a variable outside the procs makes it module-level. If you'll need
to use it across modules, make it project level:

Public sheetcnt As Integer
 
Top