really basic (pardon the pun) problems

  • Thread starter Thread starter themangostays
  • Start date Start date
T

themangostays

hi,

Call me dumb, but I've written a simple excel VBA macro that pulls the
values of various cells from various sheets on a simple invoicing
package i'm working on. One of the sheets is a reference sheet
containing client and job specific data. This sheet is then referenced
against the financial data sheet.
Why oh why can't I declair public variables that can be transfered
between forms/sheets.
I've tried everything. Can one of you clever folk tell me:

1. where should I be storing these procedures. In individual modules,
behind sheets or behind forms

2. how do I get the variables to be passed between the above

3. Where should i be declairing these variables. The're (yes you
guessed it) simple. Just cash values and strings.

Please help

Cheers

(e-mail address removed)
 
Hi,
Declare the variables in a general module - which is where you
should put your macros (unless they are associated with a userform or an
event) as below. When you open a general module you will see the caption
(Declarations) in the top right "drop down" - type in the declarations of the
Public variables. When completed i.e. when first SUB statement is encountered
a line will appear between the declarations and the macro.

HTH

Public myvar As String <=== Declare these first then add your macro(s)
Public thisvar as integer

Sub mysub1()

End Sub

Sub Mysub2

End sub
 
Hi The MangoStays,

See also responses to your post in the Excel group.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top