#1   Report Post  
Posted to microsoft.public.excel.misc
Mike Rogers
 
Posts: n/a
Default Userform Macro

I have the following macro that I am trying to adapt to work with my user
form. The user form is to prompt for a password to run a macro that unhides
a range of cells. I have not a clue what I am doing, but I am trying. Any
help would be greatly appreciated.

Sub Button1_Click()
If TextBox1.Text < "1234" Then
MsgBox "Invalid password - you cannot access this"
UnHide.Hide
Exit Sub
Else
Range("E17:E50").Select
Selection.Font.ColorIndex = 0
Range("E17").Select
ActiveSheet.Range("A1").Select

End If
End Sub

Thanks
Mike Rogers
  #2   Report Post  
Posted to microsoft.public.excel.misc
Jim Cone
 
Posts: n/a
Default Userform Macro

Mike,

Assuming you are talking about a "UserForm" and not something
you have created on a spreadsheet then this ought to get you started...
'-------------------
Private Sub CommandButton1_Click()
If TextBox1.Text < "1234" Then
MsgBox "Invalid password ", vbExclamation, "Contact Mike Rogers"
Else
With Rows("17:50")
.Hidden = False
.Font.ColorIndex = 0
End With
Range("A1").Select
End If
Me.Hide
Unload Me
End Sub
'-----------------
Regards,
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Mike Rogers" wrote in message
I have the following macro that I am trying to adapt to work with my user
form. The user form is to prompt for a password to run a macro that unhides
a range of cells. I have not a clue what I am doing, but I am trying. Any
help would be greatly appreciated.

Sub Button1_Click()
If TextBox1.Text < "1234" Then
MsgBox "Invalid password - you cannot access this"
UnHide.Hide
Exit Sub
Else
Range("E17:E50").Select
Selection.Font.ColorIndex = 0
Range("E17").Select
ActiveSheet.Range("A1").Select

End If
End Sub

Thanks
Mike Rogers
  #3   Report Post  
Posted to microsoft.public.excel.misc
Mike Rogers
 
Posts: n/a
Default Userform Macro

Jim,

Yes, It was a real "Userform", as opposed to a form that I made for others
to use. Thank you for getting me straightened out. Now I can study what
works (yours), and what does not work (mine), and see if I can understand how
I messed it up. Thanks for the response it was precisely what needed.

Mike Rogers

"Jim Cone" wrote:

Mike,

Assuming you are talking about a "UserForm" and not something
you have created on a spreadsheet then this ought to get you started...
'-------------------
Private Sub CommandButton1_Click()
If TextBox1.Text < "1234" Then
MsgBox "Invalid password ", vbExclamation, "Contact Mike Rogers"
Else
With Rows("17:50")
.Hidden = False
.Font.ColorIndex = 0
End With
Range("A1").Select
End If
Me.Hide
Unload Me
End Sub
'-----------------
Regards,
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Mike Rogers" wrote in message
I have the following macro that I am trying to adapt to work with my user
form. The user form is to prompt for a password to run a macro that unhides
a range of cells. I have not a clue what I am doing, but I am trying. Any
help would be greatly appreciated.

Sub Button1_Click()
If TextBox1.Text < "1234" Then
MsgBox "Invalid password - you cannot access this"
UnHide.Hide
Exit Sub
Else
Range("E17:E50").Select
Selection.Font.ColorIndex = 0
Range("E17").Select
ActiveSheet.Range("A1").Select

End If
End Sub

Thanks
Mike Rogers

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
Editing a simple macro Connie Martin Excel Worksheet Functions 5 November 29th 05 09:19 PM
macro with F9 Kenny Excel Discussion (Misc queries) 1 August 3rd 05 02:41 PM
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
how to run macro in userform button khurram saddique Excel Discussion (Misc queries) 2 March 4th 05 12:47 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM


All times are GMT +1. The time now is 02:28 PM.

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

About Us

"It's about Microsoft Excel"