View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.programming
MakeLei MakeLei is offline
external usenet poster
 
Posts: 47
Default Looping help needed

Hi,
I was able to solve this problem on my own - thanks for your time.
Here is how I solved it:
Sub OrgsWithNames()
Dim LRw, i, Org, OrgF
Application.ScreenUpdating = False

Columns("I:M").ClearContents
LRw = Cells(Rows.Count, "E").End(xlUp).Row

For i = 8 To LRw
If (Left(Range("A" & i).Value, 2) = 50 And Len(Range("A" & i).Value)
7) Or (Left(Range("B" & i).Value, 2) = 50 And Len(Range("B" & i).Value)

7) Then

Range("A" & i + 1).Select
Org = Range("A" & i).Value & Range("B" & i).Value

OrgF = Range("A" & i & ":B20000").Find(What:=Org,
After:=ActiveCell _
, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False,
SearchFormat:=False).Row

If OrgF i Then
Range("K" & i & ":K" & OrgF + 3).Value = Org
Range("L" & i).Value = OrgF
Else
End If

Else

End If

Next i
Application.ScreenUpdating = True

End Sub


Makelei



"MakeLei" wrote:


Hi,
Here a sample list. List is over 20 000 rows as a total. Data is in
file as it is as I get it. As you run the macro it will add organization
info to column K. I have commented rows that are problematic for me
(rows 86 - 88).

Thanks for helping me out. I know this is not very hard, but I just
don't get it...

Makelei


+-------------------------------------------------------------------+
|Filename: Example.xls |
|Download: http://www.thecodecage.com/forumz/attachment.php?attachmentid=113|
+-------------------------------------------------------------------+

--
MakeLei
------------------------------------------------------------------------
MakeLei's Profile: http://www.thecodecage.com/forumz/member.php?userid=242
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=86323