Copy row from one sheet (without a specific text) to another

eaje92

New Member
Joined
Feb 19, 2018
Messages
16
Hi all, I current have 2 sheets (one with data and one without). I would like to copy the entire row of those cells with number in the first sheet and paste it into another. It seems i have to search down the column and see ISnumeric()? if so then row().copy and paste?

Sheet1
NumberYear
11992
NANA
NANA
41880
NANA

<tbody>
</tbody>

Sheet2
NumberYear
11992
41880



<tbody>
</tbody>


Thank you!
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Try this code
DATA Range in Sheet1 is A2:B6
Data starts in Sheet2 from 3rd Row.
Code:
Sub CopyData()Dim LR As Long, X As Long, TA As Long
Dim Sh1 As Worksheet, Sh2 As Worksheet


Set Sh1 = Sheets("Sheet1")
Set Sh2 = Sheets("Sheet2")


LR = Sh1.Range("A" & Rows.Count).End(xlUp).Row
Sh1.Range("A1:B1").Copy Sh2.Range("A2")
X = 3


For TA = 2 To LR


If IsNumeric(Sh1.Range("A" & TA)) Then
Sh1.Range("A" & TA & ":B" & TA).Copy Sh2.Range("A" & X)
X = X + 1
End If


Next TA


End Sub
 
Upvote 0
Hello Eaje92,

Here is a little sample which shows the code working as it should:-

http://ge.tt/7sgwz2p2

Just as Trebor had assumed, I had assumed that you were using Columns A and B. If your opening post is not truly indicative of the set out of your workbook, then please upload a sample (an exact replica of your workbook but using dummy data) to a free file sharing site such as ge.tt or Drop Box and then post the link to your file back here.

Cheerio,
vcoolio.
 
Upvote 0

Forum statistics

Threads
1,216,179
Messages
6,129,332
Members
449,502
Latest member
TSH8125

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