View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
RichardO[_9_] RichardO[_9_] is offline
external usenet poster
 
Posts: 1
Default autofill macro has error when there is nothing to fill.

Hello all:

I need your help with the following:

Part of my macro includes the portion below. The macro works fine whe
I have more than 1 line of data i.e. I have items in row 2, 3 (row 1 i
a heading) e.t.c. But today, my data only includes information for
account, i.e. I only have info in row 2.

When I ran the macro, I was getting an error, and when I pressed debu
the "Selection.AutoFill Destination:=Range("K2:M" & ro$)" wa
highlighted in my code. So I thought maybe because I only have 1 ro
of data in row 2 and the code does not have anywhere else to autofill
what do I add to this code so that when there is only 1 line of dat
i.e. in row 2 only, it should not autofill? Do you think that wil
solve the problem?

Thanks you so much for helping me.



Range("K2").Select
ActiveCell.FormulaR1C1
"=IF(ISNA(VLOOKUP(RC[-9],bast,1,0)),"""",""YES"")"
Range("L2").Select
ActiveCell.FormulaR1C1 = _

"=IF(ISNA(VLOOKUP(RC[-10],bast,1,0)),"""",VLOOKUP(RC[-10],bast,7,0))"
Range("M2").Select
ActiveCell.FormulaR1C1 = _

"=IF(ISNA(VLOOKUP(RC[-11],ban,15,0)),"""",IF(VLOOKUP(RC[-11],ban,15,0)<=0,""Past"",IF(VLOOKUP(RC[-11],bast,15,0)5,""On"",""Yep"")))"
Range("b1").Select
Selection.End(xlDown).Select
ro$ = ActiveCell.Row
Range("K2:M2").Select
Selection.AutoFill Destination:=Range("K2:M" & ro$

--
Message posted from http://www.ExcelForum.com