Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Loop, copy, past

Greetings,

I'm looking for simple code that will loop through my worksheets, copy data
from column A (data ends on different rows on each sheet), and paste it to
column A in sheet 1.

I really appreciate the help - I don't know what I would do without this
group.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Loop, copy, past

Does this macro do what you want?

Sub CopyColAData()
Dim WS As Worksheet
Dim LR As Long
Dim LastRow As Long
Const DataColumn As String = "A"
Const SummarySheet As String = "Sheet1"
With Worksheets(SummarySheet)
LastRow = .Cells(.Rows.Count, DataColumn).End(xlUp).Row
If Not (LastRow = 1 And .Cells(LastRow, DataColumn).Value = "") Then
LastRow = LastRow + 1
End If
For Each WS In Worksheets
If StrComp(WS.Name, SummarySheet, vbTextCompare) < 0 Then
LR = WS.Cells(WS.Rows.Count, DataColumn).End(xlUp).Row
WS.Range("A1:A" & LR).Copy .Cells(LastRow, DataColumn)
LastRow = LastRow + LR
End If
Next
End With
End Sub

--
Rick (MVP - Excel)


"Robbyn" wrote in message
...
Greetings,

I'm looking for simple code that will loop through my worksheets, copy
data
from column A (data ends on different rows on each sheet), and paste it to
column A in sheet 1.

I really appreciate the help - I don't know what I would do without this
group.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Loop, copy, past

Is perfect! Thank you sooo much!

"Rick Rothstein" wrote:

Does this macro do what you want?

Sub CopyColAData()
Dim WS As Worksheet
Dim LR As Long
Dim LastRow As Long
Const DataColumn As String = "A"
Const SummarySheet As String = "Sheet1"
With Worksheets(SummarySheet)
LastRow = .Cells(.Rows.Count, DataColumn).End(xlUp).Row
If Not (LastRow = 1 And .Cells(LastRow, DataColumn).Value = "") Then
LastRow = LastRow + 1
End If
For Each WS In Worksheets
If StrComp(WS.Name, SummarySheet, vbTextCompare) < 0 Then
LR = WS.Cells(WS.Rows.Count, DataColumn).End(xlUp).Row
WS.Range("A1:A" & LR).Copy .Cells(LastRow, DataColumn)
LastRow = LastRow + LR
End If
Next
End With
End Sub

--
Rick (MVP - Excel)


"Robbyn" wrote in message
...
Greetings,

I'm looking for simple code that will loop through my worksheets, copy
data
from column A (data ends on different rows on each sheet), and paste it to
column A in sheet 1.

I really appreciate the help - I don't know what I would do without this
group.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy past loop Aqib Rizvi[_2_] Excel Programming 1 March 17th 07 10:03 PM
Copy and past from one worksheet to another Rick_T Excel Discussion (Misc queries) 3 December 29th 06 02:31 PM
Copy and Past Joe Excel Discussion (Misc queries) 1 August 17th 06 02:10 AM
Referential Copy and Past Bob Excel Programming 2 March 28th 06 04:48 PM
auto copy and past alldreams[_2_] Excel Programming 0 February 24th 04 01:26 AM


All times are GMT +1. The time now is 10:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"