View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Curious[_2_] Curious[_2_] is offline
external usenet poster
 
Posts: 23
Default Syntax for looping through rows and columns in Excel

Dave,

I want to output the cell values to a txt file by doing something like
below:

For Each myRow In myRng.Rows
For Each myCell In myRow.Cells
If myCell is not in column G Then ' What's the
correct syntax for detecting if the cell is in Column G??
Print #1, myCell.Value + ", "
Else
Print #1, myCell.Value + chr(10) ' add new
line character
End If
Next myCell
Next myRow