+ Reply to Thread
Results 1 to 7 of 7

Error 91 VBA

Hybrid View

tsamuels Error 91 VBA 03-17-2014, 12:16 AM
:) Sixthsense :) Re: Error 91 VBA 03-17-2014, 12:18 AM
tsamuels Re: Error 91 VBA 03-17-2014, 12:24 AM
:) Sixthsense :) Re: Error 91 VBA 03-17-2014, 12:53 AM
tsamuels Re: Error 91 VBA 03-17-2014, 01:06 AM
:) Sixthsense :) Re: Error 91 VBA 03-17-2014, 01:17 AM
tsamuels Re: Error 91 VBA 03-17-2014, 01:52 AM
  1. #1
    Registered User
    Join Date
    11-19-2012
    Location
    Quantico, VA
    MS-Off Ver
    Excel 2013
    Posts
    74

    Question Error 91 VBA

    Can someone please tell me what I'm doing wrong..
    Private Sub UserForm_Initialize()
    '2 of 3
         Dim properPullValue
         Dim numberOfTickers As Integer
         
         numberOfTickers = Worksheets("BasketCase").Range("C2").Value
        
        If numberOfTickers = 1 Then
        properPullValue = "BasketCase!$A$2"
        ElseIf numberOfTickers = 2 Then
        properPullValue = "BasketCase!$A$2:$A$3"
        Else
        properPullValue = "BasketCase!$A$2:$A$4"
        End If
        
    
        refTickers.Value = properPullValue
        boxStartDate.Value = Worksheets("BasketCase").Range("C5").Value
        boxEndDate.Value = Worksheets("BasketCase").Range("C7").Value
        With cboFrequency
            .AddItem "d"
            .AddItem "m"
            .AddItem "y"
            .Value = "d"
    
        End With ' cboFrequency
        refOutputRange.Value = "RawDataSheet!$A$1"
        cbDate = True
        cbOpen = True
        cbHigh = True
        cbLow = True
        cbClose = True
        cbVolume = True
        cbAdjClose = True
        labelErr.Caption = ""
        Call buttonDownload_Click
    End Sub

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Error 91 VBA

    When you click debug, it's highlighting which line of code?


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    11-19-2012
    Location
    Quantico, VA
    MS-Off Ver
    Excel 2013
    Posts
    74

    Re: Error 91 VBA

    I've attached a copy of the file. its the show form command.
    Attached Files Attached Files

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Error 91 VBA

    Delete the below line of code from Private Sub buttonDownload_Click()

    Unload Me ' close the form after loading data

  5. #5
    Registered User
    Join Date
    11-19-2012
    Location
    Quantico, VA
    MS-Off Ver
    Excel 2013
    Posts
    74

    Re: Error 91 VBA

    Thanks!, how did you realize that was the problem? also how do I get the form to go away? In fact i would prefer the form never shows up.

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Error 91 VBA

    Thanks!, how did you realize that was the problem?
    I just stepped in your code to track where it is failed. Because you are trying to open the form but having a code to unload the form via Userform Load evert. So again when the code completes the initialisation (Also Closing of Userform Also) and coming back to open the form then again the loading event triggers the same activity...

    In fact i would prefer the form never shows up
    Instead of

    ydhBulkForm.Show
    Use

    Load ydhBulkForm
    Unload ydhBulkForm

  7. #7
    Registered User
    Join Date
    11-19-2012
    Location
    Quantico, VA
    MS-Off Ver
    Excel 2013
    Posts
    74

    Re: Error 91 VBA

    Thank you so much. You saved me so much time.

+ 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. Excel macro (compile error. syntax error.) error
    By salar_younis in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-06-2014, 06:11 AM
  2. Receiving following error “Complie error : syntax error” Help
    By masond3 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-02-2012, 10:19 AM
  3. Error "run-time Error '1004': General Odbc Error
    By D4WNO77 in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-16-2012, 09:55 AM
  4. Error 75 File/Path access error, sometimes Error 1004
    By smokebreak in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-16-2011, 02:35 PM
  5. Error Handling - On Error GoTo doesn't trap error successfully
    By David in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-16-2006, 02:10 PM

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