View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
[email protected] paul.robinson@it-tallaght.ie is offline
external usenet poster
 
Posts: 789
Default Error: Type mismatch

Hi
"shortest:shortest" is a piece of text - VBA does not delve inside the
text string to extract the variables. You need

shortest & ":" & shortest

The & character will force this to be a text string with shortest
replaced with its numerical value.
regards
Paul

On Mar 11, 9:31*am, wrote:
i have a vba code included the following:
shortest = count(1)
For r = 1 To 200
If count(r) < shortest And count(r) 0 Then
shortest = count(r)
End If
Next
* * Rows("shortest:shortest").Select
* * Selection.Cut
* * Rows("1:1").Select
* * Selection.Insert Shift:=xlDown

However, when i try to run the code, the debugger promt an error
message said : type mismatch and then highlight the code:
Rows("shortest:shortest").select.
I declared "shortest" as variant.

Can any pro point out my mistake?Thank you very much