Copy and Paste rows if cells if they contain data

joh1135

Board Regular
Joined
Mar 11, 2003
Messages
156
Office Version
  1. 365
Platform
  1. Windows
I have several worksheets (TIME A, TIME B, TIME C, TIME D, TIME E...) that I want to check each row from A129:N133 to see if column A contains data. If column A contains data copy the range to worksheet DATA starting at A129.

Then check Time A to see if there is data in A130 and put that in DATA at A130:N130 and repeat down to 135

I then want to check TIME B and if there is data in A129 put the range in the next blank row after A130 - so on thru each worksheet.

So then Data a120:N140 will contain all the data from the other worksheets -

Thanks :o :o
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Untested :-

Code:
Dim sh As Worksheet
For Each sh In Worksheets
If sh.Name = "Data" Then GoTo n
sh.[A129:N133].Copy
If Sheets("Data").[A65536].End(xlUp).Row < 129 Then
Sheets("Data").Paste Destination:=Sheets("Data").[A129]
Else
Sheets("Data").Paste Destination:=Sheets("Data").[A65536].End(xlUp)(2)
End If
n:
Next
On error Resume Next
With Sheets("Data")
.Range(.[A129], .[A65536].End(xlUp)).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End With
On Error GoTo 0
 
Upvote 0

Forum statistics

Threads
1,225,761
Messages
6,186,894
Members
453,383
Latest member
SSXP

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top