Macros to copy alternate rows to anothersheet
Closed
sg
-
Apr 28, 2010 at 07:03 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Apr 28, 2010 at 08:27 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Apr 28, 2010 at 08:27 AM
Related:
- Macros to copy alternate rows to anothersheet
- Excel online macros - Guide
- How to copy macros from one workbook to another - Guide
- How to insert multiple rows in microsoft excel - Guide
- How to delete rows and columns in word - Guide
- How to recover yahoo password without phone number and alternate email - Guide
1 response
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
Apr 28, 2010 at 08:27 AM
Apr 28, 2010 at 08:27 AM
Sub copyrow()
Dim lMaxRowsCopyFrom As Long
Dim lMaxRowCopyTo As Long
Dim lCopyRow As Long
Dim lStartRow As Long
Dim sCopyFrom As String
Dim sCopyTo As String
lStartRow = 2
sCopyTo = "Sheet2"
sCopyFrom = "Sheet1"
lMaxRowsCopyFrom = Sheets(sCopyFrom).Cells(Rows.Count, "A").End(xlUp).Row
lMaxRowCopyTo = Sheets(sCopyTo).Cells(Rows.Count, "A").End(xlUp).Row
If lMaxRowCopyTo = 1 Then lMaxRowCopyTo = 2
For lCopyRow = lStartRow To lMaxRowsCopyFrom Step 2
Sheets(sCopyTo).Range(lMaxRowCopyTo & ":" & lMaxRowCopyTo) = Sheets(sCopyFrom).Range(lCopyRow & ":" & lCopyRow).Value
lMaxRowCopyTo = lMaxRowCopyTo + 1
Next lCopyRow
End Sub