+ Reply to Thread
Results 1 to 5 of 5

Code to find a specific word???

  1. #1
    Registered User
    Join Date
    05-12-2008
    Posts
    40

    Code to find a specific word???

    I require code to find a specific word in a column/sheet to add into my macro.

    My current macro:-

    Please Login or Register  to view this content.
    At the moment the macro will enter the word "*Default*" into the current active cell, then copy the entire contents of Row 2.
    The next missing code will need to find the word "*Default*" in the sheet and insert the copied cells.
    Then the next missing code again will need to find the word "*Default*" in the sheet and delete the contents of the cell so that when the macro is re-run the word *Default* is only found once.

    Hopefully when the code is searching for the specific word the copy function is not cancelled.

    Any help is appreciated, thank you.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482
    Quote Originally Posted by arfanvilla
    I require code to find a specific word in a column/sheet to add into my macro.

    My current macro:-

    Please Login or Register  to view this content.
    At the moment the macro will enter the word "*Default*" into the current active cell, then copy the entire contents of Row 2.
    The next missing code will need to find the word "*Default*" in the sheet and insert the copied cells.
    Then the next missing code again will need to find the word "*Default*" in the sheet and delete the contents of the cell so that when the macro is re-run the word *Default* is only found once.

    Hopefully when the code is searching for the specific word the copy function is not cancelled.

    Any help is appreciated, thank you.
    Hi arfanvilla,
    What is the purpose for doing this?

  3. #3
    Registered User
    Join Date
    05-12-2008
    Posts
    40
    I would like to copy the values of a row and paste to another row. However the second row to copy to must be declared before the macro has started - for example the user will select the cell to copy to and then select the macro that will copy and paste.

    One method that i thought could be to highlight the initial ActiveCell by adding text to it then copy the specified row (moving the ActiveCell). Then searching for the text (or initial ActiveCell) and move the ActiveCell to it's original position and paste the values.

    any ideas
    thanks

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482
    The user enters a word in a cell then runs the macro to search the data range for the word, once found copy and pastes the row to the active cell.

    Where is the data to copy, on a different worksheet?
    Is there more than one instance of the search item??
    What determines what cell the user selects

  5. #5
    Registered User
    Join Date
    05-12-2008
    Posts
    40
    To answer your questions - 1. on the same worksheet. 2. only one instance. 3. nothing determines what cell is selected apart from the cell that is selected to begin with (before the macro is run).

    Here's what i have and it works, bear in mind that i am not a vba expert or anywhere close to one.

    Please Login or Register  to view this content.
    if anyone has any ideas on cleaning this up that would be great - at the moment it does what it should, now i will use it in my main spreadsheet (fingers crosssed).
    Last edited by arfanvilla; 08-07-2008 at 08:48 AM.

+ 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