PC Review


Reply
Thread Tools Rate Thread

Assign Cell "B5" Value to Macro (activation function)

 
 
Shazi
Guest
Posts: n/a
 
      30th Jul 2008
Hi, Everyone,

I want to prepare one function that allows user to run specific macro
when they enter the different numbers in to "B5"

SUPPOSE:

if user Enter 777 into B5, then Run Macro "Rows_Hide"
if user Enter 888 into B5, then Run Macro "Rows_Show"

like this...........

I already feed 777 into B5, then the Macro "Rows_Hide" will run, when
the worksheet activated. then the user feed 888 into B5, then the
other Macro will run and shows all the Rows in the sheet.


Sub Rows_Hide()
Sheets("sheet2").Rows("25:65536").EntireRow.Hidden = True
End Sub

Sub Rows_Show()
Sheets("sheet2").Rows("25:65536").EntireRow.Hidden = False
End Sub

And I also want to restrict the B5 for 777 and 888 digit only.

the Sheet2 is very hidden sheet. I made a userform to change the B5
into Sheet2 by Textbox, how I restrict the Textbox1 for only for 777
and 888.

I hope that you understand my problem.

JUSTIFICATION FOR THIS FUNCTION:

Actually I made a small vba project, for all public, and I will share
this to all peoples, initially they will have this worksheet only for
25 rows data entry, once they are satisfied with this program, then
they will send me a mail for activation for unlimited access, then I
will send 888 digit for activation of this workbook.

Thank you and best regard.

Shahzad
Madinah
 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      30th Jul 2008
You could do it with the worksheet change event code. Right click your
worksheet tab, view code and paste this in

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$B$5" Then
Select Case Target.Value
Case Is = 777
Rows_Hide
Case Is = 888
Rows_Show
Case Else

End Select
End If
End Sub

Mike

"Shazi" wrote:

> Hi, Everyone,
>
> I want to prepare one function that allows user to run specific macro
> when they enter the different numbers in to "B5"
>
> SUPPOSE:
>
> if user Enter 777 into B5, then Run Macro "Rows_Hide"
> if user Enter 888 into B5, then Run Macro "Rows_Show"
>
> like this...........
>
> I already feed 777 into B5, then the Macro "Rows_Hide" will run, when
> the worksheet activated. then the user feed 888 into B5, then the
> other Macro will run and shows all the Rows in the sheet.
>
>
> Sub Rows_Hide()
> Sheets("sheet2").Rows("25:65536").EntireRow.Hidden = True
> End Sub
>
> Sub Rows_Show()
> Sheets("sheet2").Rows("25:65536").EntireRow.Hidden = False
> End Sub
>
> And I also want to restrict the B5 for 777 and 888 digit only.
>
> the Sheet2 is very hidden sheet. I made a userform to change the B5
> into Sheet2 by Textbox, how I restrict the Textbox1 for only for 777
> and 888.
>
> I hope that you understand my problem.
>
> JUSTIFICATION FOR THIS FUNCTION:
>
> Actually I made a small vba project, for all public, and I will share
> this to all peoples, initially they will have this worksheet only for
> 25 rows data entry, once they are satisfied with this program, then
> they will send me a mail for activation for unlimited access, then I
> will send 888 digit for activation of this workbook.
>
> Thank you and best regard.
>
> Shahzad
> Madinah
>

 
Reply With Quote
 
Shazi
Guest
Posts: n/a
 
      31st Jul 2008
On Jul 30, 5:43*pm, Mike H <Mi...@discussions.microsoft.com> wrote:
> You could do it with the worksheet change event code. Right click your
> worksheet tab, view code and paste this in
>
> Private Sub Worksheet_Change(ByVal Target As Range)
> If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
> If Target.Address = "$B$5" Then
> Select Case Target.Value
> * * Case Is = 777
> * * * * Rows_Hide
> * * Case Is = 888
> * * * * Rows_Show
> * * Case Else
>
> * * End Select
> End If
> End Sub
>
> Mike
>
>
>
> "Shazi" wrote:
> > Hi, Everyone,

>
> > I want to prepare one function that allows user to run specific macro
> > when they enter the different numbers in to "B5"

>
> > SUPPOSE:

>
> > if user Enter 777 into B5, then Run Macro "Rows_Hide"
> > if user Enter 888 into B5, then Run Macro "Rows_Show"

>
> > like this...........

>
> > I already feed 777 into B5, then the Macro "Rows_Hide" will run, when
> > the worksheet activated. then the user feed 888 into B5, then the
> > other Macro will run and shows all the Rows in the sheet.

>
> > Sub Rows_Hide()
> > * * Sheets("sheet2").Rows("25:65536").EntireRow.Hidden = True
> > End Sub

>
> > Sub Rows_Show()
> > * * Sheets("sheet2").Rows("25:65536").EntireRow.Hidden = False
> > End Sub

>
> > And I also want to restrict the B5 for 777 and 888 digit only.

>
> > the Sheet2 is very hidden sheet. *I made a userform to change the B5
> > into Sheet2 by Textbox, how I restrict the Textbox1 for only *for 777
> > and 888.

>
> > I hope that you understand my problem.

>
> > JUSTIFICATION FOR THIS FUNCTION:

>
> > Actually I made a small vba project, for all public, and I will share
> > this to all peoples, initially they will have this worksheet only for
> > 25 rows data entry, once they are satisfied with this program, then
> > they will send me a mail for activation for unlimited access, then I
> > will send 888 digit for activation of this workbook.

>
> > Thank you and best regard.

>
> > Shahzad
> > Madinah- Hide quoted text -

>
> - Show quoted text -


Hi Mike H,

Good Morning,

I got your Function, its working Excellllllent. Exactly I needed
that....

Thank you very much for your support.

Regards.

Shahzad
Madinah
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assign macro to shortcut keys "ctrl + 1"? Johan Microsoft Excel Programming 2 17th Sep 2009 10:52 AM
How to assign/call a function when a "Close" button of a Form is cliecked? Carla Simeoni Microsoft C# .NET 2 24th May 2007 06:35 PM
"assign macro" not an option from short menu =?Utf-8?B?U3RldmVK?= Microsoft Excel Misc 2 18th May 2006 05:55 PM
commnd button - when i rt click, "assign macro" isnt an option... =?Utf-8?B?a2V2aW4=?= Microsoft Excel Programming 1 12th Nov 2004 09:52 PM
how to assign a "hot-key" or "Macro" to Word "strikethough" feature =?Utf-8?B?TWlrZQ==?= Microsoft Word Document Management 3 5th Dec 2003 10:24 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:45 PM.