View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Isis[_2_] Isis[_2_] is offline
external usenet poster
 
Posts: 51
Default A little excel vb help ?

I am trying to read each row in an excel sheet and write i tout to a CSV
file - got most of that working.

While I am reading each cell, I am reformatting some cells (concatenating
etc) before writing it out. I was using the following line to get the
Text value from a cell;

Selection.Cells(RowCount, ColumnCount).Text

but I now don't want to use a Selection - how do I just refer to a single
cell ?

I am now going to loop through the Rows only - then I will gather the
contents of each cell in a Row into one long string.

So I want something like;

strVariable = Cell(RowCount, 1)
strVariable = Trim(strVariable) & Cell(RowCount, 2) & _
Cell(RowCount, 3) & _
Cell(RowCount, 4) & ","
Print #FileNum, strVariable;

but I don't think Print Cell(RowCount, 1) is the right VB code.

Any help appreciated.
Thanks