Runtime error 438
Others have shown you code that does not use Select and Selection. Perhaps
this previous posting of mine (a response to another person using
Select/Selection type constructions) will be of some help to you in your
future programming...
Whenever you see code constructed like this...
Range("A1").Select
Selection.<whatever
you can almost always do this instead...
Range("A1").<whatever
In your particular case, you have this...
Range("C2:C8193").Select 'select cells to export
For Each r In Selection.Rows
which, using the above concept, can be reduced to this...
For Each r In Range("C2:C8193").Rows
Notice, all I have done is replace Selection with the range you Select(ed)
in the previous statement and eliminate the process of doing any
Select(ion)s. Stated another way, the Selection produced from
Range(...).Select is a range and, of course, Range(...) is a range... and,
in fact, they are the same range, so it doesn't matter which one you use.
The added benefit of not selecting ranges first is your active cell does not
change.
--
Rick (MVP - Excel)
"Greg Snidow" wrote in message
...
Greetings. I came across a site that helps introduce the concept of
macros.
There is one example...
Sub Example2()
For x = 1 To 5
Cells(x, 3).Select
Selection.Vaue = x + 1
Next x
End Sub
that is simple enough, but when I try to run it, I get 'Runtime error
'438'
Object doesn't support this property or method'. When I hit help, it says
some stuff about a friend procedure being called late bound, and
automation
objects. Does anyone know what is happening? Thank you.
Greg
|