Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Count backwards


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 o
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 Su
-------------------

--
leonida
-----------------------------------------------------------------------
leonidas's Profile: http://www.excelforum.com/member.php...fo&userid=3537
View this thread: http://www.excelforum.com/showthread.php?threadid=55686

  #2   Report Post  
Posted to microsoft.public.excel.programming
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default Count backwards

You need:
For i = 10 to 1 Step -1

Andrew

leonidas wrote:
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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Count backwards


Hi,

Thank you both for the solution to my problem!
It works!
Thanks again

--
leonida
-----------------------------------------------------------------------
leonidas's Profile: http://www.excelforum.com/member.php...fo&userid=3537
View this thread: http://www.excelforum.com/showthread.php?threadid=55686

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count backwards N cells cferoiu Excel Worksheet Functions 0 February 2nd 10 12:50 PM
Help with backwards lookup XFILES Excel Discussion (Misc queries) 1 September 14th 07 05:45 PM
VB backwards compatability mike Excel Programming 6 August 10th 05 03:46 PM
backwards sum choice[_2_] Excel Programming 0 February 28th 05 07:23 AM
Tab backwards Garry Jones Excel Programming 3 November 5th 03 11:41 AM


All times are GMT +1. The time now is 07:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"