Put inside a loop?

for I = 1 to 10 ‘howmany_________?

Set objExcel = CreateObject("Excel.Application")
     Set objWorkbook
= objExcel.Workbooks.Open("C:\Users\Sam\Desktop\DelAllRowsExcelA”& I &”.xls")
     for each wks in objworkbook.worksheets
     wks.Range("A2", wks.UsedRange.SpecialCells(11)(2)).EntireRow.Delete
     next
     objWorkbook.Save '"C:\Users\Sam\Desktop\DelAllRowsExcelA”& I & “.xls"
     objWorkbook.Close
     objExcel.Application.Quit
     WScript.Echo "Finished."
     WScript.Quit
next i


Don Guillett
SalesAid Software
dguille...@gmail.com

From: yogananda muthaiah 
Sent: Thursday, January 19, 2012 9:51 AM
To: excel-macros@googlegroups.com ; samde...@gmail.com 
Subject: Re: $$Excel-Macros$$ Need looping in VB script

Dear Sam, 

Please refer mail below where successful VB script done by you

Now new challenge is in desktop as 2 excel 

Example : C:\Users\Sam\Desktop\DelAllRowsExcelA1.xls
                C:\Users\Sam\Desktop\DelAllRowsExcelA2.xls

how to do loop in vb script ?


     Set objExcel = CreateObject("Excel.Application")
     Set objWorkbook = 
objExcel.Workbooks.Open("C:\Users\Sam\Desktop\DelAllRowsExcelA1.xls")
     for each wks in objworkbook.worksheets
     wks.Range("A2", wks.UsedRange.SpecialCells(11)(2)).EntireRow.Delete
     next
     objWorkbook.Save '"C:\Users\Sam\Desktop\DelAllRowsExcelA1.xls"
     objWorkbook.Close
     objExcel.Application.Quit
     WScript.Echo "Finished."
     WScript.Quit 



Regards
Yogananda Muthaiah




On Sat, Jan 14, 2012 at 11:07 PM, yogananda muthaiah 
<yogananda.mutha...@gmail.com> wrote:

  $uperb sam... Really ur great.

  Thank you and regards
  Yogananda Muthaiah


  On 1/14/12, Sam Mathai Chacko <samde...@gmail.com> wrote:
  >     Set objExcel = CreateObject("Excel.Application")
  >     Set objWorkbook =
  > objExcel.Workbooks.Open("C:\Users\Sam\Desktop\DelAllRowsExcelA1.xls")
  >     for each wks in objworkbook.worksheets
  >     wks.Range("A2", wks.UsedRange.SpecialCells(11)(2)).EntireRow.Delete
  >     next
  >     objWorkbook.Save '"C:\Users\Sam\Desktop\DelAllRowsExcelA1.xls"
  >     objWorkbook.Close
  >     objExcel.Application.Quit
  >     WScript.Echo "Finished."
  >     WScript.Quit
  >
  > Regards,
  >
  > Sam Mathai Chacko
  >
  > On Sat, Jan 14, 2012 at 9:48 PM, yogananda muthaiah <
  > yogananda.mutha...@gmail.com> wrote:
  >
  >> Hi sam
  >> As you provided in excel vba .. I would need the same to run through vb
  >> script.
  >>
  >> keep 1 xl in desktop with records which we need *.vbs
  >> to run delete rows from range A2 to till end in xl
  >>
  >> On 1/14/12, Sam Mathai Chacko <samde...@gmail.com> wrote:
  >> > Try in vb script? I have no idea what you are trying to convey.
  >> >
  >> > On Sat, Jan 14, 2012 at 6:30 PM, yogananda muthaiah <
  >> > yogananda.mutha...@gmail.com> wrote:
  >> >
  >> >> Thank you sam!!!!
  >> >> Can you please try in vb script on same
  >> >>
  >> >> On 1/14/12, Sam Mathai Chacko <samde...@gmail.com> wrote:
  >> >> > Sub DelRows()
  >> >> >
  >> >> >     Dim wks As Worksheet
  >> >> >
  >> >> >     For Each wks In ThisWorkbook.Worksheets
  >> >> >         With wks
  >> >> >             .Range("A2",
  >> >> > .UsedRange.SpecialCells(xlCellTypeLastCell)(2)).EntireRow.Delete
  >> >> >         End With
  >> >> >     Next wks
  >> >> >
  >> >> > End Sub
  >> >> >
  >> >> > Regards,
  >> >> >
  >> >> > Sam Mathai Chacko
  >> >> >
  >> >> > On Sat, Jan 14, 2012 at 8:07 AM, yogananda muthaiah <
  >> >> > yogananda.mutha...@gmail.com> wrote:
  >> >> >
  >> >> >> Dear All,
  >> >> >>
  >> >> >> Congrats for all excel macros group users ,
  >> >> >>
  >> >> >> I have a excel where data is in Sheet1 to Sheet4.
  >> >> >>
  >> >> >> I would expect from any one of you to provide macro for getting rows
  >> >> >> delete from row 2 to till end
  >> >> >>
  >> >> >> Only Header should remain when macros runs. (i.e Range "A1" should
  >> >> remain)
  >> >> >>
  >> >> >>  Please try to help out through excel VBA or VBS
  >> >> >>
  >> >> >>
  >> >> >>
  >> >> >> Regards
  >> >> >> Yogananda Muthaiah
  >> >> >> Ph : 973 123 7267
  >> >> >>
  >> >> >>  --
  >> >> >> FORUM RULES (986+ members already BANNED for violation)
  >> >> >>
  >> >> >> 1) Use concise, accurate thread titles. Poor thread titles, like
  >> Please
  >> >> >> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need
  >> Advice
  >> >> >> will not get quick attention or may not be answered.
  >> >> >>
  >> >> >> 2) Don't post a question in the thread of another member.
  >> >> >>
  >> >> >> 3) Don't post questions regarding breaking or bypassing any security
  >> >> >> measure.
  >> >> >>
  >> >> >> 4) Acknowledge the responses you receive, good or bad.
  >> >> >>
  >> >> >> 5) Cross-promotion of, or links to, forums competitive to this forum
  >> in
  >> >> >> signatures are prohibited.
  >> >> >>
  >> >> >> NOTE : Don't ever post personal or confidential data in a workbook.
  >> >> Forum
  >> >> >> owners and members are not responsible for any loss.
  >> >> >>
  >> >> >>
  >> >> >>
  >> >>
  >> 
------------------------------------------------------------------------------------------------------
  >> >> >> To post to this group, send email to excel-macros@googlegroups.com
  >> >> >>
  >> >> >
  >> >> >
  >> >> >
  >> >> > --
  >> >> > Sam Mathai Chacko
  >> >> >
  >> >> > --
  >> >> > FORUM RULES (986+ members already BANNED for violation)
  >> >> >
  >> >> > 1) Use concise, accurate thread titles. Poor thread titles, like
  >> Please
  >> >> > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need
  >> Advice
  >> >> will
  >> >> > not get quick attention or may not be answered.
  >> >> >
  >> >> > 2) Don't post a question in the thread of another member.
  >> >> >
  >> >> > 3) Don't post questions regarding breaking or bypassing any security
  >> >> > measure.
  >> >> >
  >> >> > 4) Acknowledge the responses you receive, good or bad.
  >> >> >
  >> >> > 5)  Cross-promotion of, or links to, forums competitive to this forum
  >> in
  >> >> > signatures are prohibited.
  >> >> >
  >> >> > NOTE  : Don't ever post personal or confidential data in a workbook.
  >> >> Forum
  >> >> > owners and members are not responsible for any loss.
  >> >> >
  >> >> >
  >> >>
  >> 
------------------------------------------------------------------------------------------------------
  >> >> > To post to this group, send email to excel-macros@googlegroups.com
  >> >> >
  >> >>
  >> >> --
  >> >> Sent from my mobile device
  >> >>
  >> >>
  >> >>
  >> >>
  >> >> Regards
  >> >> Yogananda Muthaiah
  >> >> Ph : 973 123 7267
  >> >>
  >> >> --
  >> >> FORUM RULES (986+ members already BANNED for violation)
  >> >>
  >> >> 1) Use concise, accurate thread titles. Poor thread titles, like Please
  >> >> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
  >> >> will not get quick attention or may not be answered.
  >> >>
  >> >> 2) Don't post a question in the thread of another member.
  >> >>
  >> >> 3) Don't post questions regarding breaking or bypassing any security
  >> >> measure.
  >> >>
  >> >> 4) Acknowledge the responses you receive, good or bad.
  >> >>
  >> >> 5)  Cross-promotion of, or links to, forums competitive to this forum
  >> >> in
  >> >> signatures are prohibited.
  >> >>
  >> >> NOTE  : Don't ever post personal or confidential data in a workbook.
  >> Forum
  >> >> owners and members are not responsible for any loss.
  >> >>
  >> >>
  >> >>
  >> 
------------------------------------------------------------------------------------------------------
  >> >> To post to this group, send email to excel-macros@googlegroups.com
  >> >>
  >> >
  >> >
  >> >
  >> > --
  >> > Sam Mathai Chacko
  >> >
  >> > --
  >> > FORUM RULES (986+ members already BANNED for violation)
  >> >
  >> > 1) Use concise, accurate thread titles. Poor thread titles, like Please
  >> > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
  >> will
  >> > not get quick attention or may not be answered.
  >> >
  >> > 2) Don't post a question in the thread of another member.
  >> >
  >> > 3) Don't post questions regarding breaking or bypassing any security
  >> > measure.
  >> >
  >> > 4) Acknowledge the responses you receive, good or bad.
  >> >
  >> > 5)  Cross-promotion of, or links to, forums competitive to this forum in
  >> > signatures are prohibited.
  >> >
  >> > NOTE  : Don't ever post personal or confidential data in a workbook.
  >> Forum
  >> > owners and members are not responsible for any loss.
  >> >
  >> >
  >> 
------------------------------------------------------------------------------------------------------
  >> > To post to this group, send email to excel-macros@googlegroups.com
  >> >
  >>
  >> --
  >> Sent from my mobile device
  >>
  >>
  >>
  >>
  >> Regards
  >> Yogananda Muthaiah
  >> Ph : 973 123 7267
  >>
  >> --
  >> FORUM RULES (986+ members already BANNED for violation)
  >>
  >> 1) Use concise, accurate thread titles. Poor thread titles, like Please
  >> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
  >> will not get quick attention or may not be answered.
  >>
  >> 2) Don't post a question in the thread of another member.
  >>
  >> 3) Don't post questions regarding breaking or bypassing any security
  >> measure.
  >>
  >> 4) Acknowledge the responses you receive, good or bad.
  >>
  >> 5)  Cross-promotion of, or links to, forums competitive to this forum in
  >> signatures are prohibited.
  >>
  >> NOTE  : Don't ever post personal or confidential data in a workbook. Forum
  >> owners and members are not responsible for any loss.
  >>
  >>
  >> 
------------------------------------------------------------------------------------------------------
  >> To post to this group, send email to excel-macros@googlegroups.com
  >>
  >
  >
  >
  > --
  > Sam Mathai Chacko
  >
  > --
  > FORUM RULES (986+ members already BANNED for violation)
  >
  > 1) Use concise, accurate thread titles. Poor thread titles, like Please
  > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will
  > not get quick attention or may not be answered.
  >
  > 2) Don't post a question in the thread of another member.
  >
  > 3) Don't post questions regarding breaking or bypassing any security
  > measure.
  >
  > 4) Acknowledge the responses you receive, good or bad.
  >
  > 5)  Cross-promotion of, or links to, forums competitive to this forum in
  > signatures are prohibited.
  >
  > NOTE  : Don't ever post personal or confidential data in a workbook. Forum
  > owners and members are not responsible for any loss.
  >
  > 
------------------------------------------------------------------------------------------------------
  > To post to this group, send email to excel-macros@googlegroups.com
  >

  --
  Sent from my mobile device




  Regards
  Yogananda Muthaiah
  Ph : 973 123 7267





-- 



Regards
Yogananda Muthaiah
Ph : 973 123 7267


-- 
FORUM RULES (986+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5) Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 
 
NOTE : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.
 
------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

-- 
FORUM RULES (986+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

Reply via email to