none
VBA to find the end of a cell value RRS feed

  • Question

  • Been told this is a very good forum for asking VBA questions, I have a big big question for VBA with Excel.

    I was wondering if there's some function in VBA, that finds the last character of a cell, insersts a space and inserts a variable, from a loop that copies over a cell value from an external sheet.

    The process I made for it in the sense of a diagram is:

    It goes down the products list, finds the activecell.value (or what ever bit after the dot/cant remember if its value or formula I put in), and does a ctrl+f function on the x reference list on an external sheet and then loops through the results, switching between the 2 spreadsheets in Excel, makes a new row in the products list I download as part of the macro, and adds in rows when it finds the corresponding value

    * MAIN QUESTION: What I was wondering, is there a way of making excel find the end of a cell value and adding in the results each time within that result of finding the cell value in the ctrl+f function i made in VBA? *

    Really impressed myself with what I have done so far but just stuck now, think my imagination is stuck now lol.

    Hope to hear from you very soon.

    Regards,
    Jeremy.
    Thursday, April 9, 2009 11:16 AM

All replies

  • Hi,

    This is one way of doing it. It mimics using going to the last row in a column and using End+Up key stroke. The offset then references the empty row below the end of the columns data.

    Cells(rows.Count,1).end(xlup).offset(1,0).value = "X"
    Cheers
    Thursday, April 9, 2009 1:31 PM
  • Jeremy,

    when you say     "find the end of a cell value and adding in the results each time within that result of finding the cell value"

    do you mean you want to get the actual value of the cell and then add something to it?  say you had the word "Jeremy" in the cell.  then you want to add your last name to it for example to read "Jeremy something" in the cell?

    also, there might be some other methods you have not seen for getting cell values.

    can you give more details on exactly what you want.

    Jeff
    FREE DEVELOPER TOOLS, CODE & PROJECTS at www.srsoft.us Database Code Generator and Tutorial
    Thursday, April 9, 2009 1:39 PM