XLA routines: EE_ExtractRow
EE_ExtractRow extracts a row from a data table, and puts it on a new sheet either transposed, or the same.
- useful for extracting a record and analysing
Sub EE_ExtractRow(Optional SourceSht As Worksheet, Optional TargetSht As String, Optional RowToExtract As Long, Optional wb As Workbook, Optional blnTranspose As Boolean = True) ' takes the selected cell row as default ' copies and paste transpose onto a new sheet ' copies row and header onto sheet specified 'http://excelexperts.com/xla-routines-eeExtractRow for updates on this sub If SourceSht Is Nothing Then Set SourceSht = ActiveSheet End If If IsMissing(wb) Then Set wb = ActiveWorkbook End If If RowToExtract = 0 Then RowToExtract = Selection.Cells(1).Row End If If Not EE_SheetExists(TargetSht) Then TargetSht = "TempSht" End If Call EE_ReplaceSheet(TargetSht) If blnTranspose Then Call EE_Copy(SourceSht.Rows(1), Sheets(TargetSht).Cells(2, 1), True, True, blnTranspose) Call EE_Copy(SourceSht.Rows(RowToExtract), Sheets(TargetSht).Cells(2, 2), True, True, blnTranspose) Sheets(TargetSht).Cells(1) = "HEADING" Sheets(TargetSht).Cells(1, 2) = "VALUE" Else Call EE_Copy(SourceSht.Rows(1), Sheets(TargetSht).Cells(1, 1), True, True, blnTranspose) Call EE_Copy(SourceSht.Rows(RowToExtract), Sheets(TargetSht).Cells(2, 1), True, True, blnTranspose) End If Call EE_FinalFormatSheet(TargetSht) End Sub
»
- Nick's blog
- Login or register to post comments
- 3603 reads
Recent comments
5 years 36 weeks ago
6 years 22 weeks ago
6 years 34 weeks ago
6 years 37 weeks ago
6 years 38 weeks ago
6 years 43 weeks ago
6 years 52 weeks ago
7 years 2 days ago
7 years 3 days ago
7 years 3 days ago