Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default Simple VBA question

Caution: Make sure that the variable is declared only once in your project.
And that it is also not declared inside of any of the modules.

Found duplicating Public variables in my modules caused Crashes...

--
sb
"Chip Pearson" wrote in message
...
Srdan,

Declare the variables outside of and before any procedure. E.g.,

Public X As Integer
Sub Macro1()
' code
End Sub
Sub Macro2()
' code
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Srdan Kovacevic" wrote in message
...
Hi,

I have Macro1 and Macro2.

Macro2 repeatedly calls Macro1, and after each execution attempts to

draw
some values from several variables in Macro1. Of course, it fails

because
I
don't know how to declare those variables in Macro1 so they can be used

by
Macro2...

I've read the help and tried declaring them with Public statement, but

it
doesn't work, cause apparently I'm doing it at a wrong level. I'm quite

new
to the concept of VBA, so this whole levels, modules & whatnot thing is
totally lost upon me... :)

Could somebody try to explain it to me how and where to declare those

global
variables so I can use them in both subs (macros).

thanks in advance






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Less then simple question KG[_2_] Excel Discussion (Misc queries) 3 July 1st 08 07:07 PM
IF formula-simple question; simple operator Rich D Excel Discussion (Misc queries) 4 December 6th 07 03:36 PM
Simple Simple Excel usage question BookerW Excel Discussion (Misc queries) 1 June 23rd 05 10:06 PM
a simple question David Price[_2_] Excel Programming 0 September 1st 03 02:13 PM
Simple Question katrina wade Excel Programming 1 July 10th 03 04:55 AM


All times are GMT +1. The time now is 10:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"