![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Jefferson City, Missouri
Posts: 383
|
Can you supply a textbox with a password using vba?
what I mean is: I use a textbox to ask the user for a password upon a sheets activation. I use code to sort data on other sheets when a cells contents changes. But it keeps the sheet activated, but each time it sorts it then asks for a password, can I supply the textbox with the password at the end of my sorting code so I don't have to enter a password each time a make a change? I tried using TextBox1 = "password" but it still asked me for a password. thanks,
__________________
I appreciate the help from everyone at Mr. Excel. viper |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Post the code you are using to do all this.
Then perhaps someone can help you amend it. |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Jefferson City, Missouri
Posts: 383
|
Here is the code used upon activation:
Private Sub Worksheet_Activate() Cells.EntireColumn.Hidden = True UserForm2.Show 'this userform just asks for a password End Sub Here is the code used for cell change: Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("c6:c10, c13:c41")) Is Nothing Then Application.Run ("Alphabetizenames") End If Sheet2.Activate 'this keeps the page active 'here is where I need to supply the password so that it won't ask each time it Alphabetizes End Sub Thanks,
__________________
I appreciate the help from everyone at Mr. Excel. viper |
|
|
|
|
|
#4 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
Try putting in: Application.enableevents = false before the sheet2.activate you will have to reset this back in your code somewhere! ie. application.enableevents=true |
|
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Feb 2002
Location: Jefferson City, Missouri
Posts: 383
|
Thanks Ivan but didn't work. I put your suggestion at the end of my macro, and before the sheet activation but it disabled all my macros, wouldn't even alphabetize. It's really not that annoying it only is during the first entry because we have to input all our team members and it asks after each entry for the password, but after that it's okay. I thank you for your suggestion though.
__________________
I appreciate the help from everyone at Mr. Excel. viper |
|
|
|
|
|
#6 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
To resolve this (and if you don't mind) you can send me the workbook....I just can't think straight....I think I getting sick |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|