Thread: Count backwards
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default Count backwards

Try:
For i = 10 To 1 Step -1

RBS

"leonidas" wrote in
message ...

Hi,

I have the following macro but it won't work, because, what I think,
the backward counting "For i = 10 To 1" doesn't work.
Is there a solution for this problem so it can count backwards or
change the names of the ComboBoxes from 10 to 1 ? Thanks in advance!


Code:
--------------------
Sub Test()

Dim ws As Worksheet
Dim i As Long

Set ws = ActiveSheet

For i = 10 To 1
Call LinkCombo(ws.OLEObjects("ComboBox" & i), "ComboBox" & i + 1)
Next i

End Sub
Private Sub LinkCombo(pCombo As OLEObject, pName As String)

With pCombo
.Name = pName
End With

End Sub
--------------------


--
leonidas
------------------------------------------------------------------------
leonidas's Profile:
http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=556869