View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Kevin Porter Kevin Porter is offline
external usenet poster
 
Posts: 38
Default Code for dealing with #REF

Yes, reading back over it, it is a bit obscure. Let's try again, because the
second one is close to what I need.

I am writing code that looks at a specific cell (RowToFind,ColToFind) and
checks if it has an error condition, in this case I know it will be a #REF
error. If it is errored then I want to sum all cells from (RowToFind, 5) to
(RowToFind, ColToFind - 1) and write that number into (RowToFind, ColToFind).
The following is the code I tried:

If IsError(Cells(RowToFind, ColToFind)) Then Workbooks("SRA Detailed Payroll
- " & WBDate & ".xls").Sheets("Shreveport").Cells(RowToFind, ColToFind) =
"=Sum(cells(RowToFind, 5):cells(rowtofind, coltofind[-1]))"


I think I am ok up to the =Sum command.

Thanks again for your help and patience.