+ Reply to Thread
Results 1 to 5 of 5

How to Control the userForms and their Comand Button

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-22-2012
    Location
    Bhubaneswar
    MS-Off Ver
    Excel 2007
    Posts
    100

    Wink How to Control the userForms and their Comand Button

    Hello Sir,

    in my last post i was asked to Mr. stojk89 sir to create / insert a new sheet automatically when i enter the name in Listed range

    He explained me with beautiful solutions and with good example work book

    the code is

    Option Explicit
    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim isect As Range
        Dim n As Integer
        Dim SheetExists As Boolean
        If Target.Cells.Count > 1 Then Exit Sub
    
        On Error GoTo ResetApplication
        Application.EnableEvents = False
    
        Set isect = Intersect(Target, Range("B:B"))
    
        If Not isect Is Nothing And Target <> "" Then
            For n = 1 To Sheets.Count
                If Sheets(n).Name = Target Then
                    SheetExists = True
                    Exit For
                End If
            Next
            If Not SheetExists Then
                ThisWorkbook.Sheets.Add After:=Worksheets(Worksheets.Count)
    
                ActiveSheet.Name = Target
    
                Me.Activate
                Target.Select
                Sheets("Sandhya Enterprises").Range("A:Z").Copy Sheets(Target.Value).Range("A1")
                
                With Sheets(Target.Value)
                    .Range("B2").Value = .Name
                End With
                Sheets(Target.Value).Activate
            End If
        End If
    
    ResetApplication:
        Err.Clear
        On Error GoTo 0
        Application.EnableEvents = True
        Set isect = Nothing
    End Sub

    Which base sheet is coping for new sheet, in the base sheet i insert the array formula

    when i insert a new name in list then the sheet is copied and pasted in with inserted name

    when i protect the base sheet then it will working but the formulas are not working it's coping as like text of the base sheet

    so how can i copy the base sheet with formulas when the sheet is protected

    if possible Kindly suggest

    With Regards

    Patnaik
    Last edited by Cutter; 09-07-2012 at 05:47 PM. Reason: Added code tags

  2. #2
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: How to Control the userForms and their Comand Button

    Please use CODE tags for inserting Codes
    This part of code needs to be changed:
    From
    Target.Select
    Sheets("Sandhya Enterprises").Range("A:Z").Copy Sheets(Target.Value).Range("A1")
    
    With Sheets(Target.Value)
    To
    Target.Select
    Sheets("Sandhya Enterprises").Unprotect Password:="passwod" 'replase password with actual password
    Sheets("Sandhya Enterprises").Range("A:Z").Copy Sheets(Target.Value).Range("A1")
    Sheets("Sandhya Enterprises").Protect Password:="passwod" 'replase password with actual password
    
    With Sheets(Target.Value)
    Last edited by stojko89; 09-07-2012 at 08:32 AM. Reason: missed code tags

  3. #3
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: How to Control the userForms and their Comand Button

    @ Patnaik

    Welcome to the forum.

    Please notice that code tags have been added to your post(s). The forum rules require them so please keep that in mind and add them yourself whenever showing code in any of your future posts. To see instructions for applying them, click on the Forum Rules button at top of the page and read Rule #3.
    Thanks.

  4. #4
    Forum Contributor
    Join Date
    08-22-2012
    Location
    Bhubaneswar
    MS-Off Ver
    Excel 2007
    Posts
    100

    Re: How to Control the userForms and their Comand Button

    Hello Sir,

    thanks for your valuable MSG

    Sir, actually on that post i don't have an idea but after all about my codes i did as per your direction

    Thanking You

    With Regards

    Patnaik

  5. #5
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: How to Control the userForms and their Comand Button

    Patnaik if you ar satisfied with the answer that you were given and your problem is solved then please mark this thread as [SOLVED]
    First post select thread tools / and mark this thread as SOLVED.

    Also don't forget to thank the user that helped you by clicking the * under his post.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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