You need to declare the variable in a regular code module, NOT
the worksheet's code module. However, if you do declare it in a
sheet's code module, you can refer to it with the worksheet's
codename as a qualifier. E.g.,
[in Sheet1]
Public MyVar As Long
[in Sheet2]
Sheet1.MyVar = 123
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"Jack" wrote in message
...
using vba in excell how do I create a variable in one work
sheet so that it
can be seen by all the other worksheets in the same workbook. I
have tried
public x as interger but this does not seem to work.
--
Jack Allen