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
- Macros in excel download free - Download - Spreadsheets
- How to delete a row in a table in word - Guide
- Excel online macros - Guide
- Unlock excel vba and excel macros - Guide
- Excel macro to create new sheet based on value in cells - 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