Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
loopig in Macro Programming
In ordinary programming language like Basic we have a command called "loop"
which is used for recurring a command or a series of commands to reach a criteria. How should it be done in Macro? Specifically I want to cut and paste specified cells and then do it again for another cells. Any help is highly appreciated. TIA, Rasoul |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
loopig in Macro Programming
All MS Office programming is in the Visual Basic for Applications
language, which should give you an idea of how it ties in with Basic. ;-) -- Regards, Tushar Mehta, MS MVP -- Excel www.tushar-mehta.com Excel, PowerPoint, and VBA add-ins, tutorials Custom MS Office productivity solutions In article , says... In ordinary programming language like Basic we have a command called "loop" which is used for recurring a command or a series of commands to reach a criteria. How should it be done in Macro? Specifically I want to cut and paste specified cells and then do it again for another cells. Any help is highly appreciated. TIA, Rasoul |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
loopig in Macro Programming
Rasoul,
You have a number of options a For loop which uses a counter, such as For i = 1 To 10 Cells(i,"A").Value = i Next i a For Each loop which uses an o bject, such as i=1 For Each cell In Range ("A1:A10") cell.Value = i i = i + 1 Next cell or a Do Loop i = 1 Do Cells(i,"A").Value = i i = i + 1 Loop Until i 10 Obviously the boundary criteria will change depending upon your requirement, as will the actions. There is also a While statement, but I don't use it but you may want to look up in Help. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Rasoul Khoshravan Azar" wrote in message ... In ordinary programming language like Basic we have a command called "loop" which is used for recurring a command or a series of commands to reach a criteria. How should it be done in Macro? Specifically I want to cut and paste specified cells and then do it again for another cells. Any help is highly appreciated. TIA, Rasoul |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
loopig in Macro Programming
From vba HELP index asking for LOOP
Do...Loop Statement Repeats a block of statements while a condition is True or until a condition becomes True. Syntax Do [{While | Until} condition] [statements] [Exit Do] [statements] Loop Or, you can use this syntax: Do [statements] [Exit Do] [statements] Loop [{While | Until} condition] The Do Loop statement syntax has these parts: Part Description condition Optional. Numeric expression or string expression that is True or False. If condition is Null, condition is treated as False. statements One or more statements that are repeated while, or until, condition is True. -- Don Guillett SalesAid Software "Rasoul Khoshravan Azar" wrote in message ... In ordinary programming language like Basic we have a command called "loop" which is used for recurring a command or a series of commands to reach a criteria. How should it be done in Macro? Specifically I want to cut and paste specified cells and then do it again for another cells. Any help is highly appreciated. TIA, Rasoul |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
loopig in Macro Programming
Rasoul,
There are a variety of loop structures available in VBA. For example: For/Next, For Each/Next, Do While, and Do Until. See on line help for more details or post back with a more specific question. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Rasoul Khoshravan Azar" wrote in message ... In ordinary programming language like Basic we have a command called "loop" which is used for recurring a command or a series of commands to reach a criteria. How should it be done in Macro? Specifically I want to cut and paste specified cells and then do it again for another cells. Any help is highly appreciated. TIA, Rasoul |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro / Programming to lock cells | Excel Discussion (Misc queries) | |||
Macro Programming Question | Excel Discussion (Misc queries) | |||
Programming (macro) breaks due to translation | Excel Discussion (Misc queries) | |||
macro programming problem | Excel Programming | |||
Macro Programming | Excel Programming |