Results 1 to 2 of 2

Adding and deleting to a list from two different workbooks.

Threaded View

emilyloz Adding and deleting to a list... 06-10-2013, 09:19 AM
emilyloz Re: Adding and deleting to a... 06-11-2013, 10:29 AM
  1. #1
    Forum Contributor
    Join Date
    05-20-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2010
    Posts
    255

    Adding and deleting to a list from two different workbooks.

    Hello,

    So I have two workbooks that I am using. They both contain sheets that are for 'READ ONLY' purposes, but can only be changed from macros.
    I have one workbook that is only accessible to certain users and another workbook accessible to other users. I currently have a macro that adds and deletes to a certain column in the read only sheet by unprotecting it and then protecting it. Is there a way to add and delete to both workbooks whenever an item is added from either workbook?

    Here is the code that I am using just for the macro to add to the workbook in which it belongs to:
    Private Sub DAddLocateBTN_Click()
    
    Sheets("-READ ONLY-").Unprotect "123steel"
    
        If Len(DaddLocationTB.Value) Then
            With Worksheets("-READ ONLY-")
                'Add entry to combobox
                Dlocationcb.AddItem DaddLocationTB.Value
                DDelLocationcb.AddItem DaddLocationTB.Value
                'Store entries on read only column f
                .Range("C" & Rows.Count).End(xlUp).Offset(1, 0).Value = DaddLocationTB.Value
                'Clear textbox
                Me.DaddLocationTB.Value = vbNullString
            End With
        End If
        
    Sheets("-READ ONLY-").Protect "123steel"
    
    End Sub
    and the code to delete items:
    Private Sub DdelLocateBTN_Click()
    
    Sheets("-READ ONLY-").Unprotect "123steel"
    
        Worksheets("-Read Only-").Range("C" & DDelLocationcb.ListIndex + 2).Delete
        DDelLocationcb.Value = ""
        Call Dload
        
        'finds the selected item and deletes from spreadsheet.
    
    Sheets("-READ ONLY-").Protect "123steel"
    
    End Sub
    This code belongs to my work book: "data"

    and I want it to sync with my other work book "MillSteel-Reports"

    I have attached the workbooks:

    Passwords for the read only sheets are "123steel"
    and password for the MillSteel-Report Workbook is "steel123"

    My question might not be too clear, so my apologies in advance

    Please Help
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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