Dear

If you want a variabler such that it will works for all the procedure
in a module use below.

dim sh as worksheet
dim rng as range

Private sub abc()

set sh = Thisworkbook.Sheets("Sheet1")
set rng = sh.range("a1:c"&sh.range("c"&rows.count).end(xlup).row)

End sub


or else  If you want it access from any module try below one..

Public sh as worksheet
Public rng as range

Private sub abc()

set sh = Thisworkbook.Sheets("Sheet1")
set rng = sh.range("a1:c"&sh.range("c"&rows.count).end(xlup).row)

End sub

Regards,
Lalit Mohan


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

Reply via email to