help defining variable in Visual Basic please.

  Newuser3443 11:34 12 Oct 2005

I am using VB 6.3
I have a macro than calls a number of subroutines. The 1st macro includes the line.....

numsheets = sheets.count

which gives me the number of worksheets.

How do I declare numsheets as a variable so that I can use this result in the other subroutines?

I have very little experience of VB, so in the simplest terms possible please.

Thanks for reading this and for any assistance you can offer.

  tasslehoff burrfoot 23:13 12 Oct 2005

I think it's

Public numsheets as Integer

But I'm probably wrong!

  Forum Editor 23:23 12 Oct 2005

from WebDesign.

  VoG II 10:01 13 Oct 2005

click here

I'm confused. Do you mean VBA in Excel?

All you need to do is insert the following at the top of the module

Dim numsheets

If you have more than one module and you need each of them to access numsheets then use

Public numsheets

  Newuser3443 20:36 13 Oct 2005

Thanks again VoG, I do mean VBA (I didn't realise there was a difference).


This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Xiaomi Mi Mix 2 review

What went wrong at the Designs of the Year 2017

iPhone X news: Release date, price, new features & specs

Comment créer, modifier et réinitialiser un compte Apple ?