View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Macro for selecting rows

It sounds like you are trying to fill in the blanks.
a


b


c

to become
a
a
a
a
b
b
c
c
c

If so, try

sub fillin()
mc = 1 'col A
For i = Cells(Rows.Count, mc).End(xlUp).Row To 2 Step -1
If Cells(i - 1, mc) = "" Then Cells(i - 1, mc) = Cells(i, mc)
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"JOSEPH WEBER" wrote in message
...
I have a spreadsheet I am creating from a query ran in another program. I
have gotten pretty far in the macro programming as far as what i would
like
to do. There is one part i can't figure out. I have the macro set up so
it
looks for a value in sheet two to tell it which lines to copy, but i cant
figure out how to tell Excel to do it. for example, the data in column a
is
a name, then all other lines in column a are blank for that particular
person. Once the macro comes across another name, i want it to select the
previous line all the way back up to the name, so i can get that whole
section. I have a counter set up so i can tell it how many lines to copy,
but just can't figure out how to tell Excel to do that.