Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: "Run Time error '9' - Subscript out of range"
Thanks Thanks: 0 Likes Likes: 0

  1. #11
    Board Regular
    Join Date
    Mar 2002
    Location
    Portsmouth.UK
    Posts
    557
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Yes certainly. Here you go:

    Option Explicit
    Dim TopicCount As Integer
    Dim CurrentTopic As Integer
    Dim HelpSheet As Worksheet

    Const AppName As String = "Clares Automated Pricing System"
    Const HelpSheetName As String = "HelpSheet"
    Const HelpFormCaption As String = AppName

    Private Sub Help()
    FormHelp.Show
    End Sub

    Private Sub UserForm_Initialize()
    'Executed before the form is shown
    Dim Row As Integer
    Set HelpSheet = ThisWorkbook.Sheets(HelpSheetName)
    TopicCount = Application.WorksheetFunction.CountA(HelpSheet.Range("A:A"))
    For Row = 1 To TopicCount
    ComboBoxTopics.AddItem HelpSheet.Cells(Row, 1)
    Next Row
    ComboBoxTopics.ListIndex = 0
    CurrentTopic = 1
    UpdateForm
    End Sub
    Kindest Regards

    Peter

  2. #12
    Board Regular
    Join Date
    Aug 2003
    Location
    Maidstone, Kent UK
    Posts
    1,470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I think that you need to use Public declarations for the form to be able to see them
    Code:
    Option Explicit
    Public TopicCount As Integer
    Public CurrentTopic As Integer
    Public HelpSheet As Worksheet
    
    Public Const AppName As String = "Clares Automated Pricing System"
    Public Const HelpSheetName As String = "HelpSheet"
    Public Const HelpFormCaption As String = AppName
    HTH

    Peter

  3. #13
    Board Regular
    Join Date
    Mar 2002
    Location
    Portsmouth.UK
    Posts
    557
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: "Run Time error '9' - Subscript out of range"

    Thanks now have got it working. I initially had it in the personal workbook, however I have now placed it in the workbook that I am working in and works ok. Thanks for you patience and help

    Kindest Regards all
    Kindest Regards

    Peter

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •