HockeyDiablo

Board Regular
Joined
Apr 1, 2016
Messages
182
0down votefavorite
Having a heck of a time looping this; D2 is where my list starts. I would like to have it ran for d3, d4, d5, d6.... until a blank space.
This program searches for the name in Column D and if it finds it, it places it in Column E so that would need to also increase with column D; e2,e3,e4,e5,e6...

Sub james()

Dim celltxt As String

celltxt = ActiveSheet.Range("D2").Value

DELETE_EJ

If InStr(1, celltxt, "Christy", vbTextCompare) Then Range("E2").Value = "Christy"
ElseIf InStr(1, celltxt, "Kari", vbTextCompare) Then Range("E2").Value = "Kari"
ElseIf InStr(1, celltxt, "Sue", vbTextCompare) Then Range("E2").Value = "Sue"
ElseIf InStr(1, celltxt, "Clayton", vbTextCompare) Then Range("E2").Value = "Clayton"


<tbody>
</tbody>
 
Last edited:

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
for j=2 to 100
if cells(j,4)...............then cells(j,5) = ..........
next j

you can have as many if cells(j,4)= as you have names to check
 
Upvote 0

Forum statistics

Threads
1,216,099
Messages
6,128,822
Members
449,470
Latest member
Subhash Chand

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