Loop

K

kevin carter

Hi
I have come accross this code on the news group
which i would like to try and alter


Sub WhosWho()
Dim SourceSheet As Worksheet
Dim xCell As Range, CurrentDoctor As String
'WHERE IS THE INFO?
Set SourceSheet = Worksheets("sheet2")
Application.ScreenUpdating = False
SourceSheet.Copy After:=SourceSheet
With ActiveSheet
.Rows(1).ClearContents
Set xCell = [a2]
'DRS NAMES MUST BE SORTED; USE FOLLOWING LINE IF NECESSARY
xCell.CurrentRegion.Sort key1:=xCell, key2:=xCell.Offset(0, 1)
Do While xCell <> ""
With xCell
CurrentDoctor = .Value
Range(.Offset(0), .Offset(1)).EntireRow.Insert
shift:=xlDown
With .Offset(-1, 1)
.Value = "Dr. " & CurrentDoctor
Range(.Offset(0), .Offset(0,
2)).Borders(xlBottom).LineStyle = xlThin
End With
End With
Do
Set xCell = xCell.Offset(1)
Loop Until xCell <> CurrentDoctor
Loop
.Columns(1).Delete
Application.Goto .[a1], True
End With
End Sub

What i want to do is copy data from sheet1 on a condition and paste it
onto the second sheet in a set range ie rows ("a1 to a10") this range
is set even if there is not enough rows to fill them. I then want to
paste into the next 10 rows on another condition i.e ("a11 to A20")

is this posible

thanks in advance

kevin
 
F

Frank Stone

yes. that is possible. what are the conditions?
P.S. the code you supplied doesn't seem to have anything
to do with what you are wanting.
 
Top