Hi All,

I am trying to write a Macro to do the following:
It will Count the number of sheets in the workbook and then copy the
contents of all the sheets into a sheet called "Results". Following is the
code that I have written. But the problem is the Nested For Loop is not
working. Once it enters in the inner loop, it never comes out of the innet
loop and hence the macro execution ends.
Sub copyRows_1()
Dim SiteCol As Range, Cell As Object, SheetCount As Long, m As Long
Application.Volatile
SheetCount = Sheets.Count
For m = 1 To SheetCount - 1
Sheets(m).Activate
MsgBox "Copying From Sheet " & ActiveSheet.Name
Set SiteCol = Range("A1:A700")
For Each Cell In SiteCol
If IsEmpty(Cell) Then
Exit Sub
End If
Cell.EntireRow.Copy
Sheets("Results").Activate
ActiveSheet.Range("A65536").End(xlUp).Select
Selection.Offset(1, 0).Select
ActiveSheet.Paste
Next Cell
Next m
End Sub
Need help in arranging the FOR loop properly!

Thanks in Advance
Andy

--~--~---------~--~----~------------~-------~--~----~
-------------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
-------------------------------------------------------------------------------------
-~----------~----~----~----~------~----~------~--~---

Reply via email to