June 20th, 2008, 5:27 pm
QuoteOriginally posted by: jpsnjI don't think your questions are too tough. I ask them to write a simple routine in VBA such as removing leading and trailing spaces from A1:Z10000There are many ways to do this and I can usually guage a person's level by the method they use.If they write something similar to Sub A, they are "trainable"If they write something like Sub b, I rate them as solidIf they write sub C, they have been doing Excel vba for a long long time.Sub a() Dim i For i = 1 To Range("A1:Z10000").Cells.Count Range("A1:Z10000").Cells(i).Select Selection.Value = Trim(Selection.Value) NextEnd SubSub b() Dim rng As Range Application.ScreenUpdating = False For Each rng In Range("A1:Z10000").Cells rng.Value = Trim(rng.Value) NextEnd SubSub c() Dim v As Variant, i As Long, j As Long v = Range("A1:Z10000").Value For i = LBound(v, 1) To UBound(v, 1) For j = LBound(v, 2) To UBound(v, 2) v(i, j) = Trim(v(i, j)) Next Next Range("A1:Z10000").Value = vEnd SubI don't agree with you. I would rate c) as a very inefficient programmer. He wastes lots of time and memory resources to do what you've asked him. So, for me He's the worst.I have to apologize. I've just tried code c) and it's more efficient than I thought. You're right!
Last edited by
BullBear on June 20th, 2008, 10:00 pm, edited 1 time in total.