Selecting rows in excel
Closed
Nic
-
Mar 26, 2010 at 06:48 AM
rizvisa1 Posts 4479 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Mar 26, 2010 at 11:02 AM
rizvisa1 Posts 4479 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Mar 26, 2010 at 11:02 AM
Related:
- Selecting rows in excel
- Excel date format dd.mm.yyyy - Guide
- Number to words in excel - Guide
- Screenshot in excel - Guide
- 1st, 2nd, 3rd position formula in excel ✓ - Office Software Forum
- How to enable vba in excel - Guide
1 reply
rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
768
Mar 26, 2010 at 11:02 AM
Mar 26, 2010 at 11:02 AM
Assumptions
1. Data is on sheet1
2. rows are to be copied on sheet2
1. Data is on sheet1
2. rows are to be copied on sheet2
Sub moveRows() Dim lMaxRows As Long Dim rowIdx As Long Dim inString As String Dim lbeanCounter As Integer Sheets("Sheet1").Select lMaxRows = Cells(Rows.Count, "A").End(xlUp).Row lbeanCounter = 1 For rowIdx = 2 To lMaxRows Sheets("Sheet1").Select inString = Trim(Cells(rowIdx, "A")) If Len(inString) = 4 Then lbeanCounter = lbeanCounter + 1 Rows(rowIdx).Select Selection.Copy Sheets("Sheet2").Select Rows(lbeanCounter).Select ActiveSheet.Paste End If Next End Sub