Dear Friend,
I need a VBA Code that check the column A on Sheet 1 and if find numeric data (numbers like 1-2-3 ....) on column A copy their row to sheet 2 .
Thank you very much.
Dear Friend,
I need a VBA Code that check the column A on Sheet 1 and if find numeric data (numbers like 1-2-3 ....) on column A copy their row to sheet 2 .
Thank you very much.
Use below code
Sub test() Dim iRNum As Integer, temp As Integer, iRNum2 As Integer iRNum = 2 iRNum2 = 2 While Sheet1.Range("A" & iRNum).Value <> vbEmpty If IsNumeric(Sheet1.Range("A" & iRNum).Value) Then Sheet1.Range("A" & iRNum).EntireRow.Copy Sheet2.Range("A" & iRNum2) iRNum2 = iRNum2 + 1 End If iRNum = iRNum + 1 Wend End Sub
Thank you , but code does not work , for example my data are not ordered and consecutive , that mean I have also blank row between my data on row A . and after blank row this code will not copy my other data .
And Also the speed of running code in slow. (it is not so important)
Thank you again.
Use this one
And it working faster I have tested it on 5000 rows of data where it copied 3500 rows on sheet2 in 4 seconds.Sub test() Dim iRNum As Integer, temp As Integer, iRNum2 As Integer, LastRow As Long Debug.Print Now() LastRow = Sheet1.Range("A& Rows.Count).End(xlUp).Row iRNum = 2 iRNum2 = 2 While iRNum <= LastRow If IsNumeric(Sheet1.Range("A" & iRNum).Value) And Sheet1.Range("A" & iRNum).Value <> vbEmpty Then Sheet1.Range("A" & iRNum).EntireRow.Copy Sheet2.Range("A" & iRNum2) iRNum2 = iRNum2 + 1 End If iRNum = iRNum + 1 Wend Debug.Print Now() End Sub
Thank you , it is done,
Thanks for your big help .
You are welcome.
Please mark this thread as Solved