+ Reply to Thread
Results 1 to 9 of 9

Change line of code using userform

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Change line of code using userform

    Hello everybody
    I think my thread may look weird but I'm sure everything is possible
    I have this code that protect all sheets with a password 123
    Please Login or Register  to view this content.
    I have a userform with a textbox . I need simply to put a password in the textbox and click change password commandbutton to change the password in the macro called "ProtectAll"
    Is that possible?
    Attached Files Attached Files

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Change line of code using userform

    you need to have the old password in order to update a protected sheet.

    you can pass the old and new password to the subroutine

    Please Login or Register  to view this content.
    code in user form would be
    Please Login or Register  to view this content.
    userform would have 3 textboxes for old, new and confirmation of new.
    Attached Files Attached Files
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Change line of code using userform

    Thanks a lot Mr. Andy Pope for this masterpiece .
    It seems that I didn't clarify well my request.
    I would like to learn how to edit the code by code >> edit the subroutines using another code or userform ..
    Hope it is clear now

  4. #4
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Change line of code using userform

    maybe something like this
    Module1 code
    Please Login or Register  to view this content.
    UserForm1 code
    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Change line of code using userform

    Mr. nilem
    Thanks a lot for this great help
    It's fantastic .. Really amazing

    Can I specify a certain subroutine withing the module?

  6. #6
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Change line of code using userform

    Quote Originally Posted by YasserKhalil View Post
    ...Can I specify a certain subroutine withing the module?
    just for example
    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Change line of code using userform

    Thanks Mr. nelim
    I really didn't recogize that code well ..
    Can you please put some comments to get it easily?

  8. #8
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Change line of code using userform

    Please Login or Register  to view this content.
    and see also here

  9. #9
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Change line of code using userform

    Thanks a lot Mr. nilem
    Can you attach a file so as to be able to get it more..as I tried to apply your code several times but I didn't get my target.
    I need to change only specific subroutine and ignore all other subroutines inside the same module
    Say this is the module
    Please Login or Register  to view this content.
    I just need to affect the subroutine named "ProtectAll" only

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] how to change userform code to worksheet code
    By Learning ExL in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-04-2015, 04:25 AM
  2. [SOLVED] Need help in code to add save data from userform to next empty line in excel
    By MedSter2015 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-23-2014, 01:51 AM
  3. [SOLVED] Code error: Wont submit data from userform to seperate sheet and new line
    By mwinter in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-07-2014, 10:11 AM
  4. VBA code to change pivot chart line on 12 charts
    By NMullis in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 05-13-2009, 11:48 AM
  5. [SOLVED] Change reference style in line of code
    By Biff in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-10-2005, 08:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1