Computer Engineers

 
Home | Computer engineering other top | Fiber / Wireless / Copper Tran | Semiconductor engineering
  Position:HOME>Programming language engineeri>Article Content
VB-ITERATION
Source:Internet Author:Unknow Pubdate:2008-04-14  
L775 (Structural) 27 Nov 04 20:04
How do I stop AN iteration when it reaches the end of a group of occupied cells filled with the IDENTICAL text (i.e. B277) in a column?

I want it to stop at the end of the list. HOW does it know that the next
cell is empty so it will not error or use an empty cell.
the length of the list in a column or number of rows varies for different
groups that the routine or loop neet to operate on. thank you for your help.
I know there is a way of doing.




L775 (Structural) 27 Nov 04 20:41
I WOULD ALSO LIKE THE SCRIPT TO TELL ME THE NUMBER OF ROWS CONTAINED IN THE GROUP.

THANKS A LOT

johnwm (Computer) 28 Nov 04 12:14
Start from the first cell and use a Do Loop, increementing the row counter and checking for the appropriate value: 字串3

CODE

Private Sub CommandButton1_Click()
a = 1
Do While ActiveSheet.Cells(a, 1) = "b277"
Cells(a, 2) = a ' or do whatever you need here
a = a + 1
Loop
MsgBox a - 1 & " Cells affected"
End Sub
The example starts looking at A1 and goes down until the cell value changes. Change the initial value of a to start at a different row. The second value in the first Cells function (1 in this case) sets the column to search Good Luck
johnwm
________________________________________________________
To get the best from these forums read FAQ731-376 before posting

UK steam enthusiasts: www.essexsteam.co.uk

L775 (Structural) 28 Nov 04 14:32
thanks johnwm,
it worked good

PDB123 (Computer) 1 Dec 04 7:21
As fasr as i know you just put it inside a whiloe loop with a <>EOF command!
字串2



(Click:

Previous:Creating a Flowsheet GUI   Next:PDA programming...
[Add TO Favorites] [TOP] [PRINT] [CLOCE WINDOWS]  
  Hot Article
·PIC code for triac light dimme
·Connecting a Footswitch to an
·Siemens s7-200 PLC & Visua
·TETRIS source code is availabl
·XML Files and Terramodel
·controlling GPIB from VBA
·LINKING MSC PATRAN WITH INTRAN
·How to interface RS-485 / Modb
·VBA WITH AB PLC
·SIEMENS: I/O, NCDDE AND DCTL
·getch() function
·Visual Basic Serial Comms To S
  Related Articles
·PDA programming...
·24CXX Serial EEPROM programmin
·Hardware Interfacing thru C..
·VB6 Running Another Program
·getlogin in C programming
·RowSource problem with Combobo
·Porting a Windows NT C++ app t
·Visual Basic
·Convert Excel to PDF
·Automatic delete files
·Prolog help
·C win32 threads
Power by DedeCms