+ Reply to Thread
Results 1 to 11 of 11

Creating a new sheet with each new line item

Hybrid View

  1. #1
    Registered User
    Join Date
    11-22-2021
    Location
    Huron Township, Michigan
    MS-Off Ver
    365
    Posts
    32

    Re: Creating a new sheet with each new line item

    I hadn't been able to open the file and run the one that you sent, but I was able to finally do that. It works! Thank you. I was wondering though, and maybe this is too much, but if it could also change the cell on the template for part number C3 to the new part number - the same one as the tab is named as. Maybe that's too much. I don't know, but is it possible to add that layer?

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,010

    Re: Creating a new sheet with each new line item

    Sure - just add the line
    .Range("C3").Value = Target.Value
    After the line

    .Name = Target.Value
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    11-22-2021
    Location
    Huron Township, Michigan
    MS-Off Ver
    365
    Posts
    32

    Re: Creating a new sheet with each new line item

    Thank you so much for your help! But now, I have one more additional question...
    Is there a way to add the safety critical note after the fact. For example, If someone adds the line on the table of contents page, but then doesn't put the yes or no in the safety critical column right at the beginning, but then goes back to that later and puts "yes" for safety critical, is it possible to have the note show up on the tab that had been created already? One of my work colleagues is asking the question as I was super happy with it. If it is not possible, then that will just have to be a manual entry. Just figured I'd ask.

    Again, thank you so much for the help you've given so far!

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,010

    Re: Creating a new sheet with each new line item

    Try it like this.....

    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Target.Column <> 2 And Target.Column <> 3 Then Exit Sub
        If Target.Value = "" Then Exit Sub
        If Cells(Target.Row, 1).Value = "" Then Exit Sub
        
        On Error GoTo NoSheet
        If Target.Column = 3 Then
            Worksheets(Cells(Target.Row, 1).Value & "s Template - Blank").Copy before:=Worksheets(5)
            Worksheets(5).Name = Target.Value
            If UCase(Cells(Target.Row, 2).Value) = "YES" Then
                CriticalSafety Worksheets(5)
            End If
        End If
        
        If Target.Column = 2 And Cells(Target.Row, 3).Value <> "" Then
            If UCase(Target.Value) = "YES" Then
                CriticalSafety Worksheets(Cells(Target.Row, 3).Value)
            End If
        End If
    NoSheet:
        
    End Sub
    Private Sub CriticalSafety(shtS As Worksheet)
        With shtS.Range("H1:S1")
            .Merge
            .EntireRow.RowHeight = 36
            .Font.Size = 36
            .Interior.ColorIndex = 3
            .Value = "***THIS ITEM HAS BEEN IDENTIFIED AS SAFTEY CRITICAL***"
        End With
    End Sub

  5. #5
    Registered User
    Join Date
    11-22-2021
    Location
    Huron Township, Michigan
    MS-Off Ver
    365
    Posts
    32

    Re: Creating a new sheet with each new line item

    It works great as originally requested, but it won't add the safety critical after the fact. If you skip that column, create the new sheet, then go back and choose "Yes" to safety critical, it won't add the safety critical statement. It only works if you choose it before creating the sheet.

+ 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] Vba to match item description and copy/paste item code to other sheet
    By Sintek in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-31-2017, 11:29 AM
  2. VBA code to copy line items from form - overriding previous line item
    By dkostyan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-30-2016, 11:19 AM
  3. [SOLVED] Formula needed - line item of unique item matching criteria
    By NS4Excel in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 04-18-2015, 06:32 PM
  4. Replies: 1
    Last Post: 10-09-2013, 11:44 AM
  5. Replies: 3
    Last Post: 09-03-2013, 10:02 PM
  6. creating a macro to use cell content as subject line in sending email - protected sheet
    By John Eathorne in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-18-2013, 05:06 PM
  7. Combining multiple line items into one line item based on column.
    By mguz018 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-20-2012, 07:22 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