+ Reply to Thread
Results 1 to 13 of 13

Macro to work on any cell?

  1. #1
    Registered User
    Join Date
    06-28-2007
    Posts
    31

    Macro to work on any cell?

    Hi all ,

    i am pretty new to excel , but have been playing around with it for a while now, i am currently trying to record a macro to work on lets say cell A7

    formula =RIGHT(A7,4) now i would like to apply this to another cell further down the A column, but it could be at any cell number, but the first will always be at cell A7, is this possible??

    any advice / help would be greatly aprreciated.
    Many Thanks.

    steviegee

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Just copy the formula; the reference will adjust.

  3. #3
    Registered User
    Join Date
    06-28-2007
    Posts
    31
    Hi,


    at the risk of sounding dumb, well i suppose i am really lol, if i copy formula down the column i will end up with #VALUE# errors, or #NA# errors, i do have other txt in column A also on different cell numbers,

    could your answer be a bit more detailed please.
    steviegee

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Maybe your question could be more detailed. Want to post an example of what you're trying to do?

  5. #5
    Registered User
    Join Date
    06-28-2007
    Posts
    31
    Ok,


    Many thanks for your time
    Attached Files Attached Files

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    You could try

    =IF(ISNUMBER(SEARCH("My Result",A6)),TRIM(RIGHT(A7,4)),"")
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  7. #7
    Registered User
    Join Date
    09-29-2006
    Posts
    14

    My Apologies

    This isn't a reply - I'm asking for help on posing a new thread. I've searched all over and can't see how to start a new thread. I have a question to ask and can't get started despite being logged in. Apologies, but can someone help e please.

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    there's a new thread buton at top and bottom of each sub forum!
    then again there may be problems as the option to edit one of my posts isnt there

  9. #9
    Registered User
    Join Date
    06-28-2007
    Posts
    31
    Hi again,

    i tried the above formula , and got the error message of having too many arguments?

    any ideas,
    thanks
    steviegee

  10. #10
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    See if examples helps

    VBA Noob
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    06-28-2007
    Posts
    31
    Mighty clever, thank you,
    can you explain the formula, as to what it represents,
    very impressed.

  12. #12
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    ISNUMBER(SEARCH("My Result",A6))
    This part of the formula returns true if Cell A6 contains the text "My Result"

    The true statement then returns last four characters to the right of A7 (Cell below). The trim function removes the extra space
    TRIM(RIGHT(A7,4))
    The False statement will return blank
    ,""
    So put it all together
    =IF(ISNUMBER(SEARCH("My Result",A6)),TRIM(RIGHT(A7,4)),"")
    HTH

    VBA Noob

  13. #13
    Registered User
    Join Date
    06-28-2007
    Posts
    31
    Very much so,
    thank you for your time and help.
    steviegee

+ 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