Consulting

Page 1 of 2 1 2 LastLast
Results 1 to 20 of 25

Thread: About a Telephone Numbers Catalogue

  1. #1
    VBAX Tutor Erdin? E. Ka's Avatar
    Joined
    Sep 2006
    Location
    Bursa
    Posts
    264
    Location

    About a Telephone Numbers Catalogue

    Hi everyone!

    I want a make a sipmle "Telephone Numbers Catalogue" in Excel 2003.

    Are there anybody already have a similar sample and can share with me ?

    Thanks a lot.
    Erdin? E. Kara?am | Loves from Bursa city in Republic of T?rkiye

  2. #2
    VBAX Mentor
    Joined
    Sep 2004
    Posts
    431
    Location
    Hello Erdin? E. Kara?am
    Maybe I can return the favour ... can you describe what you are looking for in more details ?
    Regards,
    NHick

  3. #3
    VBAX Mentor
    Joined
    Sep 2004
    Posts
    431
    Location
    Three examples the first one not so simple and you need to add the rest of the option buttons on the form ... maybe someone in this forum can help with this one and get it to work without the hassle of these option buttons.
    The second and third example are very simple
    Hope one can suit your needs.
    Here is the first

  4. #4
    VBAX Mentor
    Joined
    Sep 2004
    Posts
    431
    Location
    The other two
    Regards,
    Nick

  5. #5
    VBAX Tutor Erdin? E. Ka's Avatar
    Joined
    Sep 2006
    Location
    Bursa
    Posts
    264
    Location
    Hi Nick,
    Thank you very much for your goodwill and sharing. I am so happy to this.
    esspecially "address.xls" sample is great.!

    Thank you!

    Thank you!

    Thank you!
    Erdin? E. Kara?am | Loves from Bursa city in Republic of T?rkiye

  6. #6
    VBAX Tutor Erdin? E. Ka's Avatar
    Joined
    Sep 2006
    Location
    Bursa
    Posts
    264
    Location
    Quote Originally Posted by ndendrinos
    Three examples the first one not so simple and you need to add the rest of the option buttons on the form ... maybe someone in this forum can help with this one and get it to work without the hassle of these option buttons.
    The second and third example are very simple
    Hope one can suit your needs.
    Here is the first
    I think that there is no need to using Option Button for "Rolodex.xls" sample.

    Maybe we can use the codes below instead of OptionButton.
    (Adding Into CommadnButton1_Click Event)

    [VBA]
    '
    WhichSheet = Mid(TextBox1, 1, 1)
    Select Case UCase(WhichSheet)
    Case A
    Sheets("A").Select
    Case B
    Sheets("B").Select
    '
    '
    '
    Case Z
    Sheets("Z").Select

    Case 1 Or 2 Or 3 Or 4 Or 5 Or 6 Or 7 Or 8 Or 9 Or 0
    Sheets("123").Select
    End Select
    '
    [/VBA]
    Erdin? E. Kara?am | Loves from Bursa city in Republic of T?rkiye

  7. #7
    VBAX Mentor
    Joined
    Sep 2004
    Posts
    431
    Location
    Still working to get rid of the option buttons.
    ThanksErdin?
    Thank you for your help

  8. #8
    VBAX Tutor Erdin? E. Ka's Avatar
    Joined
    Sep 2006
    Location
    Bursa
    Posts
    264
    Location
    Take it easy Nick.
    Erdin? E. Kara?am | Loves from Bursa city in Republic of T?rkiye

  9. #9
    VBAX Regular
    Joined
    Oct 2005
    Posts
    26
    Location
    May be this helps for "Rolodex.xls"

    [VBA]
    Option Explicit
    Private Sub CommandButton1_Click()
    Dim WitchSheet As String
    Dim response As String
    Dim LastRow As Object
    WitchSheet = Left(TextBox1, 1)
    Sheets(WitchSheet).Select
    Set LastRow = ActiveSheet.Range("D65536").End(xlUp)
    LastRow.Offset(1, 0).Value = TextBox1.Text
    LastRow.Offset(1, 1).Value = TextBox2.Text
    LastRow.Offset(1, 2).Value = TextBox3.Text
    MsgBox "Data Recorded"
    response = MsgBox("Do you want to enter another record?", _
    vbYesNo)
    If response = vbYes Then
    TextBox1.Text = ""
    TextBox2.Text = ""
    TextBox3.Text = ""
    TextBox1.SetFocus
    Else
    Sheets("INDEX").Select
    Range("E1").Select
    Unload Me
    End If
    End Sub
    [/VBA]

  10. #10
    VBAX Mentor
    Joined
    Sep 2004
    Posts
    431
    Location
    benny good work and thanks a ton ... Rolodex is now all done.
    Regards,
    Nick
    Thank you for your help

  11. #11
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Benny,
    Welcome to VBAX
    A couple of minor points. They don't affect the functioning here but for future use:
    The msgbox function returns an Integer. Response should be Integer or Long.
    LastRow should be Range, rather than Object.
    Regards
    MD
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  12. #12
    VBAX Tutor Erdin? E. Ka's Avatar
    Joined
    Sep 2006
    Location
    Bursa
    Posts
    264
    Location
    I see Benny's code. It's ok but, the message above that i sent was wrong and which has something missing. For instead of that codes and for an alternative i am sending a new and coplete one (" For: Private Sub CommandButton1_Click event of Rolodex.xls ") below;

    [vba]Private Sub CommandButton1_Click()
    Dim LastRow As Object
    Dim WhichSheet As String

    WhichSheet = Mid(TextBox1, 1, 1)

    Select Case UCase(WhichSheet)

    Case "A"
    Sheets("A").Select
    Case "B"
    Sheets("B").Select
    Case "C"
    Sheets("C").Select
    Case "D"
    Sheets("D").Select
    Case "E"
    Sheets("E").Select
    Case "F"
    Sheets("F").Select
    Case "G"
    Sheets("G").Select
    Case "H"
    Sheets("H").Select
    Case "I"
    Sheets("I").Select
    Case "J"
    Sheets("J").Select
    Case "K"
    Sheets("K").Select
    Case "L"
    Sheets("L").Select
    Case "M"
    Sheets("M").Select
    Case "N"
    Sheets("N").Select
    Case "O"
    Sheets("O").Select
    Case "P"
    Sheets("P").Select
    Case "R"
    Sheets("R").Select
    Case "S"
    Sheets("S").Select
    Case "T"
    Sheets("T").Select
    Case "U"
    Sheets("U").Select
    Case "V"
    Sheets("V").Select
    Case "Y"
    Sheets("Y").Select
    Case "Z"
    Sheets("Z").Select
    Case "X"
    Sheets("X").Select
    Case "Q"
    Sheets("Q").Select
    Case "W"
    Sheets("W").Select
    Case 1 Or 2 Or 3 Or 4 Or 5 Or 6 Or 7 Or 8 Or 9 Or 0
    Sheets("123").Select

    End Select

    Set LastRow = ActiveSheet.Range("D65536").End(xlUp)
    LastRow.Offset(1, 0).Value = TextBox1.Text
    LastRow.Offset(1, 1).Value = TextBox2.Text
    LastRow.Offset(1, 2).Value = TextBox3.Text
    MsgBox "Data Recorded"
    response = MsgBox("Do you want to enter another record?", _
    vbYesNo)
    If response = vbYes Then
    TextBox1.Text = ""
    TextBox2.Text = ""
    TextBox3.Text = ""
    TextBox1.SetFocus
    Else
    Sheets("INDEX").Select
    Range("E1").Select
    Unload Me
    End If
    End Sub[/vba]

    Greetings...


    And adding a deep note:
    I try Benny's code now, while writing a Company name which is beginning with a Numeric character, then i am getting "Subscpirt Out Of Range" error and yellow debug row is on:

    [vba]
    Sheets(WitchSheet).Select
    [/vba]

    row of the codes..
    Erdin? E. Kara?am | Loves from Bursa city in Republic of T?rkiye

  13. #13
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    You can reduce your select statement a bit
    [vba]
    WhichSheet = Mid(TextBox1, 1, 1)
    Select Case UCase(WhichSheet)
    Case "A" To "Z"
    Sheets(WhichSheet).Select
    Case 0 To 9
    Sheets("123").Select
    End Select
    [/vba]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  14. #14
    VBAX Tutor Erdin? E. Ka's Avatar
    Joined
    Sep 2006
    Location
    Bursa
    Posts
    264
    Location
    Quote Originally Posted by mdmackillop
    You can reduce your select statement a bit
    [vba]
    WhichSheet = Mid(TextBox1, 1, 1)
    Select Case UCase(WhichSheet)
    Case "A" To "Z"
    Sheets(WhichSheet).Select
    Case 0 To 9
    Sheets("123").Select
    End Select
    [/vba]
    Hi dear mdmackillop,

    This is not a bit reduse!

    Thank you for great support

    I love this Select-Case way.
    Erdin? E. Kara?am | Loves from Bursa city in Republic of T?rkiye

  15. #15
    VBAX Mentor
    Joined
    Sep 2004
    Posts
    431
    Location
    Here is a lighter version of "Rolodex" and all edits to the code done.
    There is still a problem and that is with "response"
    Tried to fix it along Malcom's observation to Benny but could'nt
    So to get it going I took "response" out of the code.
    Any ideas?

    Error =Compile Error Variable no Defined
    Highlited=response
    Thank you for your help

  16. #16
    VBAX Regular
    Joined
    Oct 2005
    Posts
    26
    Location
    What you think of this one.

  17. #17
    VBAX Mentor
    Joined
    Sep 2004
    Posts
    431
    Location
    Benny great ... how much do you want for it?
    Now all it needs is a search button on the form .... we'll see
    Thanks for your help
    Regards,
    Nick
    Thank you for your help

  18. #18
    VBAX Regular
    Joined
    Oct 2005
    Posts
    26
    Location
    Nick,
    you'r welcome. Glad i could help.
    I added a search-combo and made the UF modeless.
    So you can edit the sheets.
    Have fun with it.

  19. #19
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Benny,
    You're doing a great job here. The one thing I would add to complete the project is a Sort routine to the sheet when a new record is added.
    Regards
    MD
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  20. #20
    VBAX Regular
    Joined
    Oct 2005
    Posts
    26
    Location
    Thank you fir the compliment, MD.

    Here the next version.

Posting Permissions

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