+ Reply to Thread
Results 1 to 2 of 2

VB Editor keeps opening everytime i click macro button

Hybrid View

  1. #1
    Registered User
    Join Date
    06-11-2012
    Location
    Farnborough
    MS-Off Ver
    Office 2010/2007
    Posts
    14

    Angry VB Editor keeps opening everytime i click macro button

    I have been using this code for a while and it hasn't changed however suddenly it has started opening the vbeditor each time i click the button and highlights the Show

    Step 1:
    CLICK BUtton3_Click() VB EDITOR OPENS

    Sub Button3_Click()
    With UserForm1
      .StartUpPosition = 0
      .Left = Application.Left + (0.5 * Application.Width) - (0.5 * .Width)
      .Top = Application.Top + (0.5 * Application.Height) - (0.5 * .Height)
      .Show
    End With
    End Sub
    Step 2: UserForm1 opens which as 2 fields in it Stone & Lbs and save button. Code for button below:
    Private Sub CommandButton1_Click()
    Dim Last_Row As Long
    Unload UserForm1
    
    Last_Row = Range("B2").End(xlDown).Offset(1).Row
    Range("B2:J2").Copy Range("B" & Last_Row)
    
    Range("B" & Last_Row).Value = Date
    Range("C" & Last_Row).Value = StoneBox.Text
    Range("D" & Last_Row).Value = PoundsBox.Text
    
    Sheets("WeightPivot").Select
    ActiveSheet.PivotTables("PivotTable2").RefreshTable
    Sheets("WeightTracker").Select
    
    End Sub

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: VB Editor keeps opening everytime i click macro button

    What's the rest of the code?
    The .show may be highlighted but it's the useform that is having a problem initializing.

+ 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. Replies: 6
    Last Post: 10-20-2014, 09:37 AM
  2. [SOLVED] in VBA editor, How to to know if a macro is asssigned to a button ?
    By dutel in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-10-2012, 06:14 PM
  3. Replies: 0
    Last Post: 04-28-2010, 02:57 PM
  4. [SOLVED] How do I stop VB Editor window from opening when I run my macro
    By Confucius in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-20-2006, 11:10 AM
  5. Code for opening another sheet on button click
    By pmud in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-18-2005, 06:06 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