+ Reply to Thread
Results 1 to 13 of 13

Create a counter related to a word

  1. #1
    Registered User
    Join Date
    02-27-2013
    Location
    Porto
    MS-Off Ver
    Excel 2010
    Posts
    94

    Create a counter related to a word

    Hello guys! Can you help me?

    I want to create a counter related to a word in a combobox that would give me the word writen in the combobox plus a sequencial number.

    Imagine:

    Combobox1:

    OP5000
    OX200
    QR4000

    So, in excell would appear me in data if the first of OP5000: OP5000-1

    Then if I choose OX200 would appear me in data excel OX200-1

    Then If I choose OP500 again it would appear me in data OP5000-2

    .

    I hope I was clearly enough!!!
    Thanks for helping me guys!
    Cheers!

  2. #2
    Registered User
    Join Date
    02-27-2013
    Location
    Porto
    MS-Off Ver
    Excel 2010
    Posts
    94

    Re: Create a counter related to a word

    can anyone help me on this?

  3. #3
    Forum Contributor
    Join Date
    08-27-2009
    Location
    South Africa
    MS-Off Ver
    Office 2010
    Posts
    217

    Question Re: Create a counter related to a word

    Is this what you wanted?
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    02-27-2013
    Location
    Porto
    MS-Off Ver
    Excel 2010
    Posts
    94

    Re: Create a counter related to a word

    Well yes. But I need that in vb code. I'm trying to do that. But it's in the beginning.

    The programm is only counting and isn't writing the name with the action.

    Dim j, counter As Integer
    Dim coluna As Long ' introduzir a coluna de ordem de extrusão

    coluna = Folha2.Range("G" & Rows.Count).End(xlUp).Row

    counter = 1

    For j = 2 To coluna

    If ComboBox3.Value = Folha2.Range("G" & j) Then
    counter = counter + 1
    End If

    Next
    Folha2.Cells(k + 1, 10) = counter

    Can u give one idea?

    Thanks for helping me

  5. #5
    Forum Contributor
    Join Date
    08-27-2009
    Location
    South Africa
    MS-Off Ver
    Office 2010
    Posts
    217

    Re: Create a counter related to a word

    Is this what you need?
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    02-27-2013
    Location
    Porto
    MS-Off Ver
    Excel 2010
    Posts
    94

    Re: Create a counter related to a word

    No!

    The first one you put it was the right one. Let me explain it better.

    image.png

    When I choose an "ordem de extrusão" in the combobox, I would like it to appear in the data excel the "ordem de extrusão" plus the number of that "ordem the extrusão" in the "código bobine" just like you did in that excel file. The problem is that I cannot write it in VB.

    Thanks for your help!

  7. #7
    Forum Contributor
    Join Date
    08-27-2009
    Location
    South Africa
    MS-Off Ver
    Office 2010
    Posts
    217

    Re: Create a counter related to a word

    I see, is the column: código bobine a manual field? do you add 1, 2, 3 etc? Do you want to select a cell Column G ie. G5 and then when you select an item from the combobox it will replace the selected cell value = G + J?

  8. #8
    Registered User
    Join Date
    02-27-2013
    Location
    Porto
    MS-Off Ver
    Excel 2010
    Posts
    94

    Re: Create a counter related to a word

    no no, "codigo bobine" isn't a manual field. It should be automatic!

    Exactly. When you choose in ComboBox, one item from column G, in Column J it should appear the G + (the sequencial number of G).

    Did you get it?

    Thanks

  9. #9
    Forum Contributor
    Join Date
    08-27-2009
    Location
    South Africa
    MS-Off Ver
    Office 2010
    Posts
    217

    Re: Create a counter related to a word

    Ok i think I understand, look at example.
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    08-27-2009
    Location
    South Africa
    MS-Off Ver
    Office 2010
    Posts
    217

    Re: Create a counter related to a word

    here is better one
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    02-27-2013
    Location
    Porto
    MS-Off Ver
    Excel 2010
    Posts
    94

    Re: Create a counter related to a word

    yeah that's IT. but how do you write that in vba code? because it doesn't work for me..

    ty

  12. #12
    Forum Contributor
    Join Date
    08-27-2009
    Location
    South Africa
    MS-Off Ver
    Office 2010
    Posts
    217
    Its already done in vba, just go and look at the code on the combo box
    If your Dreams don't scare you......They are not big enough

    If you like my answer don't forget to click on the *

  13. #13
    Registered User
    Join Date
    02-27-2013
    Location
    Porto
    MS-Off Ver
    Excel 2010
    Posts
    94

    Re: Create a counter related to a word

    OK, it's done!

    Thanks a lot for your help!
    Last edited by rcprito; 02-28-2013 at 01:34 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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