Dear Hemant, Pls declear variable as Public and it will declear out of pocedure
Like Public abc as string Sub A() Abc="ram" Msg abc End sub Sub B() Abc="rahim" Msg abc End sub Sent from BlackBerry® on Airtel -----Original Message----- From: Excel Vba <excelvba.lear...@gmail.com> Sender: excel-macros@googlegroups.com Date: Fri, 13 Jul 2012 18:24:57 To: <excel-macros@googlegroups.com> Reply-To: excel-macros@googlegroups.com Subject: $$Excel-Macros$$ Re: Query- Global Variable Hi Group, Is it good practise to declare a global variable. But, when i use global variable in loop it performs better. Regards, excelvba.lear...@gmail.com --------------------------------------------------------------------------------------------------------------------------------------------------------- On Fri, Jul 13, 2012 at 4:51 PM, Excel Vba <excelvba.lear...@gmail.com>wrote: > Hi Group, > > > How can i declare a global variable for below mentioned. > > > > Private sub abc() > dim sh as worksheet > dim rng as range > > set sh = Thisworkbook.Sheets("Sheet1") > set rng = sh.range("a1:c"&sh.range("c"&rows.count).end(xlup).row) > > End sub > > > In my module i have 20 procedure and in future comes many more. > So, my query how to declare a global variable and how to call in my > procedure. > > Regards, > excelvba.lear...@gmail.com > > -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com To unsubscribe, send a blank email to excel-macros+unsubscr...@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com To unsubscribe, send a blank email to excel-macros+unsubscr...@googlegroups.com