+ Reply to Thread
Results 1 to 2 of 2

Locate the word and autocomment

Hybrid View

  1. #1
    Registered User
    Join Date
    07-20-2008
    Location
    holland
    Posts
    8

    Locate the word and autocomment

    Hello,

    what I basicly need is

    Lets say there is "noobs suck" randomly written on A1 to A1000 among many other words.

    I need a macro to search for "noobs suck" in whole sheet, when it locates it, it should write "Noobs do not suck" on D column at same row that it's located.

    I am sure it's something easy but I just lack the knowledge for it. Thanks a lot !

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464
    Hi,

    One way is the following macro:

    Sub LocateAndAutoComment()
    Dim rMycell As Range, rFirstcell As String
    
    With Sheet1.Range("A1:A100")
        Set rMycell = .Find("noobs suck", LookIn:=xlValues)
        If Not rMycell Is Nothing Then
            rFirstcell = rMycell.Address
            Do
                rMycell.Offset(0, 3) = "noobs do not suck"
                Set rMycell = .FindNext(rMycell)
            Loop While Not rMycell Is Nothing And rMycell.Address <> rFirstcell
        End If
    End With
    HTH

+ 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