+ Reply to Thread
Results 1 to 8 of 8

get values from cell that share the same content

  1. #1
    Registered User
    Join Date
    09-24-2012
    Location
    brazil
    MS-Off Ver
    Excel 2003
    Posts
    4

    get values from cell that share the same content

    Hi, I just started programming in VBA.


    I need to iterate through column "C" and compare the value of the cell with some string, if it is equal I need to print

    the problem is that from C8 to C35 is only in one cell (c8), how do I get all others to get this values?

    I don't know if I explained myself right, here is the excel file with the macro: Book2.xlsm

    my code:

    Please Login or Register  to view this content.
    thanks guys
    Last edited by FDibbins; 09-29-2012 at 04:22 PM.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: get values from cell that share the same content

    It's not clear for me, do you want put "CTC" in range C8:C35 ?
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    09-24-2012
    Location
    brazil
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: get values from cell that share the same content

    thanks for replying

    I want just to get the content of cells from C8 to C35 and I will then do some "operation" with them

    but the problem is that only C5 return value (CTC) the others return empty, and they should (in my opinion) return also the value "CTC"

    got it?

  4. #4
    Registered User
    Join Date
    09-24-2012
    Location
    brazil
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: get values from cell that share the same content

    because I will need to make a program that read an input that will be comparared to all the colun C.

    If the input is "CTC" for example i need to compare all the C* (C1, C2, C3...) and see if it the value is equal do "CTC" if it is I will get the whole row and put in another sheet, the problem is that C9 should be equal to "CTC" but it is not, it returns empty

  5. #5
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: get values from cell that share the same content

    how can you put a value in range C8:C35 ? you can not, there is merged cells.
    Divide cells in this range, you solve the problem
    Last edited by patel45; 09-29-2012 at 01:37 PM.

  6. #6
    Registered User
    Join Date
    09-24-2012
    Location
    brazil
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: get values from cell that share the same content

    thanks for your help

    I found this function that will help me get the values

    Please Login or Register  to view this content.

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: get values from cell that share the same content

    Hi, orr,

    or something like this:
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,050

    Re: get values from cell that share the same content

    orr, as you a new member,i have added code tags for you, but please remember to use code tags in future

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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