Anonymous asked in Computers & InternetSoftware · 9 years ago

Help in excel, VBA programming?

Hi, i problem in excel vba. im trying to program a code that removes the dashes out of a phone number with digits ###-###-#### and output it to a worksheet.. does anyone know? thanks.

3 Answers

  • 9 years ago
    Favorite Answer

    Use the replace function

    • Login to reply the answers
  • Tamara
    Lv 4
    4 years ago

    Listen to what user Devilish told you - do NOT try to learn VB.NET or even VB6 and then try to apply that to VBA - it doesn't work. VBA is a stripped-down version of VB6 that has a lot of quirks and different features of its own. You can become an excellent programmer in VB6 and then switch to VBA and be absolutely stumped because things are so different, and simple tasks become harder. It would be a waste of your time to first learn Visual Basic, then switch to Visual Basic for Applications and never be able to apply the tricks and methods you learned from VB6/.NET to VBA. I basically self-taught VBA, but I have general computer programming knowledge to back me. I've just spent a lot of time on Google and searching through code banks for workarounds, code snippets, error reports and the like. In the sources, I've listed a few of the sites I keep going back to for tips and help. (These probably won't help you learn, but they will be able to help your "How do I do this...?" type questions) You won't find extensive walkthoughs for "learning VBA" online... most sites will tell you how to do one thing or another, but they won't thoroughly walk you through the process of learning and then becoming an expert. The books that Devilish mentioned seem promising. Good luck!

    • Login to reply the answers
  • 9 years ago

    ASSUMING: your Dashed_Phone_Numbers are listed in A1:A10000

    Sub BlaBlaBla()

    Dim MyRng as Range, N as Long

    Set MyRng = Sheets("Sheet1000").Range("A1")

    Set MyRng = Range(MyRng, MyRng.End(xlDown))

    For N = 1 to MyRng.Rows.Count

    MyRng(N,1) = Replace(MyRng(N,1),"-","")

    Next N


    • Login to reply the answers
Still have questions? Get your answers by asking now.