Find series of words in a specific column, then offset 3 by columns

Burrgogi

Active Member
Joined
Nov 3, 2005
Messages
363
Office Version
  1. 2010
Platform
  1. Windows
I have a very long list of game titles in column A. (alphabetized). I need to find specific titles contained in col. A (e.g. Alien Isolation), then move the cursor over by 3 columns and typed the word "DLC" in column D.
This would be a very simple exercise if there was only 1 title to find. I have about 40. Here are the first 3 titles to start.

Alien Isolation
Antstream_Arcade
BioShock Infinite

I've googled my way around and found some examples that's close... but nothing has worked so far. I'm a complete VBA novice so I'm definitely fumbling here.

VBA Code:
Sub EGS_Test()
Dim c As Range
    With Worksheet("Titles With Library").Range("A1:A2500")
        Set c = .Find("Alien Isolation", LookIn:=xlValues, LookAt:=xlPart, SearchDirection:=xlNext)
                ActiveCell.Offset(0, 3).Range("A1").FormulaR1C1 = "DLC"
         Set c = .Find("Antstream Arcade", LookIn:=xlValues, LookAt:=xlPart, SearchDirection:=xlNext)
                ActiveCell.Offset(0, 3).Range("A1").FormulaR1C1 = "DLC"
         Set c = .Find("BioShock Infinite", LookIn:=xlValues, LookAt:=xlPart, SearchDirection:=xlNext)
                ActiveCell.Offset(0, 3).Range("A1").FormulaR1C1 = "DLC"
    End With
End Sub
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Is column D going to be just blank or 'DLC'?

Another question. You said you have about 40 titles to look for, but your range for Column A is set for A1:A2500. Does than mean you are only going to look for about 40 titles in that entire range of numerous titles in column A?

Another question. Do you have a list of the 40 names that you are going to look for already saved somewhere? If so, where?
 
Upvote 0
Is column D going to be just blank or 'DLC'?

No like I said, I want it to say DLC. That's it.

Does than mean you are only going to look for about 40 titles in that entire range of numerous titles in column A?
Correct.

Do you have a list of the 40 names that you are going to look for already saved somewhere? If so, where?

I have them saved in Notepad. If you show me how to do the first 3 via VBA method, I can manage the rest (I think, lol).
 
Upvote 0
No like I said, I want it to say DLC. That's it.
I think you misunderstood or I was not clear.

You want 'DLC' written to the column D row of the title that is found in column A. If the title was not found, Column D of that row should be left blank. Is that correct? Or is there already another value in that column D row that should be left alone?
 
Last edited:
Upvote 0
I think you misunderstood or I was not clear.

You want 'DLC' written to the column D row of the title that is found in column A. If the title was not found, Column D of that row should be left blank. Is that correct? Or is there already another value in that column D row that should be left alone?

The list of titles to be found will definitely be found in column A - there's no doubt on that. Once it finds it, I want VBA to type in "DLC" in column D. They're all blank currently.
 
Upvote 0
This should get you going:

VBA Code:
Sub Test()
'
    Dim ArrayRow                As Long, FindGameArrayCounter       As Long
    Dim Column_D_Array          As Variant, GameTitleSearchArray    As Variant, GameTitlesToFindArray   As Variant
    Dim ws                      As Worksheet
'
    Set ws = Sheets("Titles With Library")                                                              ' <--- Set this to the sheet name that contains the list of game titles to search through
'
    GameTitlesToFindArray = Array("Alien Isolation", "Antstream_Arcade", "BioShock Infinite")           ' <--- set this to list of games to search for, expand if needed, this will be a 1D zero based array
'
    GameTitleSearchArray = ws.Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)                     ' Save the list of total games from the sheet to 2D 1 Based GameTitleSearchArray
    ReDim Column_D_Array(1 To UBound(GameTitleSearchArray, 1), 1 To 1)                                  ' Set Column_D_Array to the same size as GameTitleSearchArray
'
    For ArrayRow = 1 To UBound(GameTitleSearchArray, 1)                                                 ' Loop through the rows of GameTitleSearchArray
        For FindGameArrayCounter = 0 To UBound(GameTitlesToFindArray)                                   '   Loop through GameTitlesToFindArray
            If GameTitlesToFindArray(FindGameArrayCounter) = GameTitleSearchArray(ArrayRow, 1) Then     '       If a match is found then ...
                Column_D_Array(ArrayRow, 1) = "DLC"                                                     '           Save "DLC" to Column_D_Array
                Exit For                                                                                '
            End If
        Next                                                                                            '   Loop back
    Next                                                                                                ' Loop back
'
    ws.Range("D1").Resize(UBound(Column_D_Array, 1), UBound(Column_D_Array, 2)) = Column_D_Array        ' Write the results of Column_D_Array to the sheet
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,416
Messages
6,124,772
Members
449,187
Latest member
hermansoa

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top