View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Keith[_17_] Keith[_17_] is offline
external usenet poster
 
Posts: 4
Default formulas and colorindex don't work after opentext

I am opening a text file with OpenText but when I do, and then try setting
the background color, the row color doesn't change. Yet when I set the
color from a different sub, executed AFTER the initial sub, the color is
set. Anyone experience weirdness like this before?

This is the opentext line:

Workbooks.OpenText Filename:=varFileName, DataType:=xlFixedWidth,
fieldinfo:=Array(Array(0, 1), Array(9, 2), Array(21, 3), Array(32, 1),
Array(40, 1), Array(48, 1), Array(54, 1), Array(65, 1), Array(74, 1),
Array(83, 1), Array(89, 1), Array(100, 1))

and the formula and color settings:

Cells(r, 1).EntireRow.Interior.ColorIndex = 5

yet these subs work - after the initial sub is finished - but not when
called from within the initial sub.

Sub a()
setrowcolor 5, 3
End Sub



Sub setrowcolor(rownum, rowcolor)
Cells(rownum, 1).EntireRow.Interior.ColorIndex = rowcolor
End Sub

Thanks,
Keith