Home |
Search |
Today's Posts |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You wanted the whole row copied from the original worksheets?
Option Explicit Sub CopyData() Dim sh As Worksheet Dim sh1 As Worksheet Dim i As Long, rng As Range Dim LastRow As Long Dim col As Long Application.DisplayAlerts = False On Error Resume Next Worksheets("Summary").Delete On Error GoTo 0 Application.DisplayAlerts = True Set sh = Worksheets.Add(after:=Worksheets(Worksheets.Count) ) sh.Name = "Summary" For Each sh1 In Worksheets If sh1.Name < sh.Name Then LastRow = sh1.Cells(Rows.Count, 7).End(xlUp).Row For i = 2 To LastRow If IsNumeric(sh1.Cells(i, "G").Value) Then If sh1.Cells(i, "G").Value = 1 Then Set rng = sh.Cells(Rows.Count, 1).End(xlUp)(2) rng.Value = sh1.Name col = sh1.Cells(i, "IV").End(xlToLeft).Column sh1.Range(sh1.Cells(i, "A"), _ sh1.Cells(i, col)).Copy Destination:=rng(1, 2) End If End If Next End If Next End Sub Tom's second code had this line: sh1.Range(sh1.Cells(i, "G"), _ sh1.Cells(i, col)).Copy Destination:=rng(1, 2) I changed it to column A: sh1.Range(sh1.Cells(i, "A"), _ sh1.Cells(i, col)).Copy Destination:=rng(1, 2) Tom's code copied from column G to the right. If you wanted that, change the code back. wrote: Hi Dave, I tried your suggestion.. it does not give the desired result.. it copies everything from all the sheets to Row No.2 in the Summary Sheet and keeps on over writing on the same row until the last sheet in the workbook... so what remains on Summary Sheet is the detail from the last sheet. Is this clear to you. Thanks for your time Ashish Kumar -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Conditional format lowest value greater than zero and copy formula | Excel Discussion (Misc queries) | |||
Auto extract data & inserts rows additional rows automatically | Excel Discussion (Misc queries) | |||
how do i filter a list greater than 1000 rows | Excel Discussion (Misc queries) | |||
Copy rows if greater than zero | Excel Worksheet Functions | |||
Charting when number of rows are greater than 65536 | Charts and Charting in Excel |