You are here:

Excel/Searching specific words in a column and transposing the rows in-between into columns on another sheet


I don't think this should be that complex but I'm not sure.

I have a single row of information. I'm looking for the keywords RFP, RFI, or "Advanced Notice." I'd like to copy starting from ANY of these words and stopping before the next listed keyword. Once copied I'd like to transpose the copied text to rows on a separate sheet.


Sonar Inspection
City of Ft. Wayne
Advance Notice
Engineering Services
Voltage Regulator

The above will look like this on the new sheet:

RFP   Sonar Inspection   IN   City of Ft. Wayne
Advance Notice   Engineering Services   VA   Navy
RFI   Voltage Regulator   CA, PA   Navy

This should do it, just make sure your list file is onscreen, data in column A, then run this macro:

Option Explicit

Sub CopyTransposeColumnToRows()
Dim LR As Long, rw As Long, FR As Long
Dim wsDATA As Worksheet, wsNEW As Worksheet

Set wsDATA = ActiveSheet
Set wsNEW = Sheets.Add

With wsDATA
   LR = .Range("A" & .Rows.Count).End(xlUp).Row
   For rw = 1 To LR
       Select Case .Range("A" & rw).Value
         Case "RFP", "Advance Notice", "RFI"
         If FR > 0 Then
         .Range(.Cells(FR, "A"), .Cells(rw - 1, "A")).Copy
         wsNEW.Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteAll, Transpose:=True
         End If
         FR = rw
       End Select
       If rw = LR Then
         .Range(.Cells(FR, "A"), .Cells(rw, "A")).Copy
         wsNEW.Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteAll, Transpose:=True
       End If
   Next rw
End With

End Sub  
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Jerry Beaucaire


Excel Formulas, macros, automation. Microsoft Excel MVP - 2010. Code site with free code snippets and techniques:


Microsoft Excel MVP - 2010. I have my own extensive Excel help/code site: ===================== I have been offering free assistance as an Excel aid on many web sites for many years: ( - JBeaucaire) ======== ( - JBeaucaire) ======= ( - jbeaucaire)

Bachelor's Degree from Azusa Pacific University in Mathematics and Music Composition

Awards and Honors
Microsoft Excel MVP 2010

©2017 All rights reserved.

[an error occurred while processing this directive]