+ Reply to Thread
Results 1 to 2 of 2

Why can't these 2 sets of code work in the same CommandButton??

Hybrid View

  1. #1
    Registered User
    Join Date
    01-17-2013
    Location
    canada
    MS-Off Ver
    Excel 2010
    Posts
    25

    Why can't these 2 sets of code work in the same CommandButton??

    Hey there,

    I have 2 seta of code which individually work fine...However, the only work indivually, forcing me to pick between one and the other. I'm sure both of these can work simultaneously, I just don't know how or why they aren't...Any help would be greatly appreciated. Thanks very much,

    Matt

    This code saves my txt entry into the database:

    Private Sub btn_AddNewBrand_Click()
    Dim newEntry As Variant, rws As Long, adr As String
    newEntry = FrmNewSeason.txtNewBrandName.Value
    rws = Range("Designers").Rows.Count
    Range("Designers").Cells(1, 1).Offset(rws, _
        0).Value = newEntry
    With Range("Designers").Name
        adr = .RefersTo
        .Delete
    End With
    Range(adr).Resize(rws + 1, 1).Name = "Designers"
    
    End Sub
    This codes clears everything in my txt and puts txt items on my userform back to how they were

    Private Sub btn_AddNewBrand_Click()
    FrmNewSeason.btn_StartNewSeason.Enabled = True
    FrmNewSeason.txtNewBrandName = ""
    FrmNewSeason.txtNewBrandName.BackColor = &H80000002
    FrmNewSeason.lblNewBrand.Font.Strikethrough = True
    FrmNewSeason.txtNewBrandName.Enabled = False
    FrmNewSeason.lstBrandsNewSeason.AddItem FrmNewSeason.txtNewBrandName.Text
    
    End Sub

    thanks again for any insight!!

  2. #2
    Registered User
    Join Date
    01-17-2013
    Location
    canada
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Why can't these 2 sets of code work in the same CommandButton??

    nevermind, went around the problem by creating a refresh button

+ 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