Multiple names in a loop

Benny Howard

New Member
Joined
Apr 22, 2004
Messages
15
Here is my macro. My problem I have several names and mutiple locations in a state. So, I would prefer to not, have to copy and paste this macro and insert a new name or office location on each one. I want to use the one macro, but be able to list several names in it and allow it to fill in for each name or location.

example: Bob, jane, tom belong in "X" office, in "X" State, in "X"region, in "X" division.

I hope you understand what I am trying to do and thanks.

ub FillinLeftBlanks()
Columns("A:E").Select
Selection.Replace What:="", Replacement:="fillin", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Dim i As Integer
Range("e1").Select
Do Until ActiveCell = ""
i = InStr(1, ActiveCell, "CHARLES SEMENTE")
If i > 0 Then
ActiveCell.Offset(0, -1).Select
ActiveCell = "WOODBRIDGE"
ActiveCell.Offset(0, 1).Select
End If
ActiveCell.Offset(1, 0).Select
Loop
Range("d1").Select
Do Until ActiveCell = ""
i = InStr(1, ActiveCell, "WOODBRIDGE")
If i > 0 Then
ActiveCell.Offset(0, -1).Select
ActiveCell = "NEW JERSEY"
ActiveCell.Offset(0, 1).Select
End If
ActiveCell.Offset(1, 0).Select
Loop
Range("c1").Select
Do Until ActiveCell = ""
i = InStr(1, ActiveCell, "NEW JERSEY")
If i > 0 Then
ActiveCell.Offset(0, -1).Select
ActiveCell = "EAST 1"
ActiveCell.Offset(0, 1).Select
End If
ActiveCell.Offset(1, 0).Select
Loop
Range("b1").Select
Do Until ActiveCell = ""
i = InStr(1, ActiveCell, "EAST 1")
If i > 0 Then
ActiveCell.Offset(0, -1).Select
ActiveCell = "EAST"
ActiveCell.Offset(0, 1).Select
End If
ActiveCell.Offset(1, 0).Select
Loop
Range("e1").Select

:pray:
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,214,649
Messages
6,120,733
Members
448,987
Latest member
marion_davis

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