Sub runme()
Dim s As Worksheet
Set s = Sheet1
irow = 2
Dim phoneS As String, faxS As String, emailS As String
Do While LenB(s.Cells(irow, "A").Value) > 0
irow2 = irow
phoneS = vbNullString
faxS = vbNullString
emailS = vbNullString
Do While LenB(s.Cells(irow, "A").Value) > 0
If LenB(s.Cells(irow, "B").Value) > 0 Then
phoneS = s.Cells(irow, "B").Value
End If
If LenB(s.Cells(irow, "C").Value) > 0 Then
faxS = s.Cells(irow, "C").Value
End If
If LenB(s.Cells(irow, "D").Value) > 0 Then
emailS = s.Cells(irow, "D").Value
End If
irow = irow + 1
Loop
irow = irow2
Do While LenB(s.Cells(irow, "A").Value) > 0
s.Cells(irow, "B").Value = phoneS
s.Cells(irow, "C").Value = faxS
s.Cells(irow, "D").Value = emailS
irow = irow + 1
Loop
Do While LenB(Trim$(s.Cells(irow, "A").Value)) = 0 And irow < s.UsedRange.Rows.Count
irow = irow + 1
Loop
Loop
End Sub
|