"Robert Crandal" <
rcranz...@gmail.com> wrote:
> I programmed a search feature into my VBA program. Each time a search
> hit is found I use the "Select" operation simply to highlight a particular
> row. So, I'm using Select just to make a row easily visible to users.
That is a valid use of Select. I do the same thing sometimes.
"Robert Crandal" <
rcranz...@gmail.com> wrote:
> Are you saying that I should NOT use this "Select" operation because
> it causes interprocess communication between Excel and VBA?
No. We cannot escape the interprocess communication. But it is good to
minimize it when it makes sense to do so. The operative words are "when it
makes sense".
Many people take a recorded macro and either modify it or think it serves as
a good programming model. This results in an over-use of Select and other
unnecessary features, which is grossly ineffiecient. Recorded macros are a
good way to see how to do something __in_general__. But usually, they can
and should be optimized.
For example, when entering 1, 2, 3 and 4 into A1, A2, A3 and A4, the
recorded macro is:
Range("A1").Select
ActiveCell.FormulaR1C1 = "1"
Range("A2").Select
ActiveCell.FormulaR1C1 = "2"
Range("A3").Select
ActiveCell.FormulaR1C1 = "3"
Range("A4").Select
ActiveCell.FormulaR1C1 = "4"
Obviously, the following is better (and could be optimized further):
Range("A1") = 1
Range("A2") = 2
Range("A3") = 3
Range("A4") = 4
But that comment does not seem to apply to your use of Select.
"Robert Crandal" <
rcranz...@gmail.com> wrote:
> Is this going to cause problems or bugs in my program?
No way to say without seeing the full macro. But generally, no. The
over-use of Select is just inefficient, usually not wrong.