Consulting

Results 1 to 5 of 5

Thread: add lines

  1. #1

    add lines

    hello guys,


    I need to automatically add lines through a VBA code.
    What I need is this:
    If you have only one number, add the line "1" in front of number, if have 2 equal number, then add the lines "1" and "2".
    Example:

    500 1
    501 1
    501 2
    501 3
    502 1
    503 1
    503 2
    504 1
    505 1
    505 2


    Can you help me?

    Thanks...

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    In B1 and fill down

    =COUNTIF($A$1:A1,A1)
    Capture.JPG
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    It's not work for me.

    Mine is in portuguese, but it's the same.


    Sem Título.jpg

  4. #4
    SOLVED

    =CONTAR.SE($B$2:B2;B2)

  5. #5
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,057
    Location
    Not sure how you arrived at that solution given that you are attempting to count the recurring values in Column A. The only mistake that I see in the example you posted is that you got the punctuation marks mixed up, other wise it should have worked.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Posting Permissions

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