+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 16 to 29 of 29
  1. #16
    Valued Forum Contributor swordswinger710's Avatar
    Join Date
    02-20-2008
    Location
    Bright, Canada
    MS-Off Ver
    2010
    Posts
    273

    Re: Link Parts Of Workbook Filename To Cells

    Okay - that's more like it! Wonderful! Thank you! The only issue I have yet, is that a user can change the values in those cells without being notified about it... could that be worked in there somehow?

  2. #17
    Valued Forum Contributor swordswinger710's Avatar
    Join Date
    02-20-2008
    Location
    Bright, Canada
    MS-Off Ver
    2010
    Posts
    273

    Re: Link Parts Of Workbook Filename To Cells

    So what do you think?

  3. #18
    Forum Moderator romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Alibi
    MS-Off Ver
    All
    Posts
    8,262

    Re: Link Parts Of Workbook Filename To Cells

    Another addition to the Change Event - this goes above the last snippet:
    Code:
        If Not intersect(Target, Range("B9:G9,B11:C11")) Is Nothing Then
            MsgBox "Do not change the part number or revision number. Save the file as the relevant name and the numbers will change automatically."
            On Error Resume Next
            With Application
                .EnableEvents = False
                .Undo
                .EnableEvents = True
            End With
            Exit Sub
        End If
    So long, and thanks for all the fish.

  4. #19
    Valued Forum Contributor swordswinger710's Avatar
    Join Date
    02-20-2008
    Location
    Bright, Canada
    MS-Off Ver
    2010
    Posts
    273

    Re: Link Parts Of Workbook Filename To Cells

    Wow! That works! Almost...

    When I save the blank as a part number and rev, then add additional data to the workbook, upon closing it I get the window that asks if I want to save the changes. I click yes. Then it asks me again. So I click yes. Haha, I could go on for a long time...

  5. #20
    Forum Moderator romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Alibi
    MS-Off Ver
    All
    Posts
    8,262

    Re: Link Parts Of Workbook Filename To Cells

    Can you post the current version?
    So long, and thanks for all the fish.

  6. #21
    Valued Forum Contributor swordswinger710's Avatar
    Join Date
    02-20-2008
    Location
    Bright, Canada
    MS-Off Ver
    2010
    Posts
    273

    Re: Link Parts Of Workbook Filename To Cells

    Absolutely! Here is what we have so far... Thanks again for all your time!
    Attached Files Attached Files

  7. #22
    Forum Moderator romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Alibi
    MS-Off Ver
    All
    Posts
    8,262

    Re: Link Parts Of Workbook Filename To Cells

    Add this to the ThisWorkbook module:
    Code:
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
        Dim lngResp As Long
        If Not ThisWorkbook.Saved Then
            ThisWorkbook.Saved = True
            lngResp = MsgBox("Do you wish to save the workbook before closing?", vbYesNo)
            If lngResp = vbYes Then
                ThisWorkbook.Save
            End If
        End If
    End Sub
    So long, and thanks for all the fish.

  8. #23
    Valued Forum Contributor swordswinger710's Avatar
    Join Date
    02-20-2008
    Location
    Bright, Canada
    MS-Off Ver
    2010
    Posts
    273

    Re: Link Parts Of Workbook Filename To Cells

    Hmm.. now when I close the workbook after making changes, I first get your window asking 'Do you wish to save the workbook before closing?' and I say yes, then I get the default one asking me the same thing, and I can still click Yes a hundred times in a row without it closing!

  9. #24
    Forum Moderator romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Alibi
    MS-Off Ver
    All
    Posts
    8,262

    Re: Link Parts Of Workbook Filename To Cells

    That's odd - it was working in my tests. I won't be able to look at it until next week now, I'm afraid.
    So long, and thanks for all the fish.

  10. #25
    Valued Forum Contributor swordswinger710's Avatar
    Join Date
    02-20-2008
    Location
    Bright, Canada
    MS-Off Ver
    2010
    Posts
    273

    Re: Link Parts Of Workbook Filename To Cells

    That's okay, I'll wait! Maybe you should reattach the workbook that was working for you - in case I'm doing something wrong...

  11. #26
    Forum Moderator romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Alibi
    MS-Off Ver
    All
    Posts
    8,262

    Re: Link Parts Of Workbook Filename To Cells

    Unfortunately, it's at work and I'm on my way home...
    So long, and thanks for all the fish.

  12. #27
    Valued Forum Contributor swordswinger710's Avatar
    Join Date
    02-20-2008
    Location
    Bright, Canada
    MS-Off Ver
    2010
    Posts
    273

    Re: Link Parts Of Workbook Filename To Cells

    Okay, well don't worry about it.. it's not that urgent, thanks again! And have a great weekend!

  13. #28
    Forum Moderator romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Alibi
    MS-Off Ver
    All
    Posts
    8,262

    Re: Link Parts Of Workbook Filename To Cells

    I seem to have somehow missed a bit when posting. It should be:
    Code:
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
        Dim lngResp As Long
        If Not ThisWorkbook.Saved Then
            ThisWorkbook.Saved = True
            lngResp = MsgBox("Do you wish to save the workbook before closing?", vbYesNo)
            If lngResp = vbYes Then
                With ThisWorkbook
                     .Save
                     .Saved = True
                 End With
            End If
        End If
    End Sub
    So long, and thanks for all the fish.

  14. #29
    Valued Forum Contributor swordswinger710's Avatar
    Join Date
    02-20-2008
    Location
    Bright, Canada
    MS-Off Ver
    2010
    Posts
    273

    Re: Link Parts Of Workbook Filename To Cells

    Hello! Hey, thanks so much for that! It seems to work well!

    I do have a few more questions, nothing really important, just little adjustments we could do...

    I tried to find the code where it selects the digits before the REV, so I could remove that space it puts in there after the number, but I couldn't find it! Also, if either of the two cells are clicked in and not modified, the user still gets an error message saying not to change it - I would be nicer if the error would only appear if the value was actually changed.

    Again, only trifles - but I thought I'd ask. And thanks again!

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.2.0