Loop

  • Thread starter Thread starter kevin carter
  • Start date Start date
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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Loop 3
find 2
error 5
intersect 12
Listbox problem agaie 3
Screen Flashing 6
Looping Every Nth Row to Copy & Paste Special 3
Code Help 2

Back
Top