View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Michael A Michael A is offline
external usenet poster
 
Posts: 48
Default one last macro question

ok, so this macro is working great..

Sub CopyToSheetz()

Dim rng As Range
Dim oCell As Range

Set rng = Range("B4:B" & Cells(Rows.Count, "B").End(xlUp).Row)
For Each oCell In rng
oCell.EntireRow.Copy _
Destination:=Sheets(oCell.Value).Range("A65536").E nd(xlUp).Offset(1,
0)
Next oCell


End Sub
-----

except, i have this formula in my B column

=IF(A4="","",IF(ISERROR(VLOOKUP(A4,'Names
List'!$A$5:$E$5000,2,FALSE)),"NA",VLOOKUP(A4,'Name s
List'!$A$5:$E$5000,2,FALSE)))

so when the macro gets to the lines that have the "" in it, i get a syntax
error. Can someone help me get around this? I dont need these lines copied, I
just wanetd to get rid of the #N/A if A is blank.
Any help would be great..

Thanks!