On Apr 14, 2006, at 3:00 PM, Jeremy Clifton wrote:

I'm trying to loop through all cells in a single column in an Excel spreadsheed.

Using:
RB 2006r2
OS X 10.4.6
Office v. X

From looking at the VBA reference, it *looks* as if I can do the following to loop through all the cells in column C:

-------

Dim excel as ExcelApplication
Dim wbook as ExcelWorkbook
Dim cell as ExcelRange
Dim formulas() as String

' Doing some stuff here to open the workbook ...

For Each cell in wbook.ActiveSheet.Columns("C").Cells
    If cell.HasFormula Then
        formulas.Append(cell.Formula)
    End If
Next

Try something like wbook.ActiveSheet.Cells(row,column) where row and column are numbers. So for the "C" column you could do a for loop like

for i = 1 to 100 //or whatever you want to end at...
cell = wbook.ActiveSheet.Cells(i,3)
If cell.HasFormula Then
        formulas.Append(cell.Formula)
    End If
Next

This is untested, but I think it should help.

Kevin
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to