View Single Post
 
Old 06-16-2022, 09:47 AM
p45cal's Avatar
p45cal p45cal is offline Windows 10 Office 2019
Expert
 
Join Date: Apr 2014
Posts: 956
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

Something like this?:
Code:
Sub Courses()
Dim LRow As Long
Dim Found As Range

With Sheets("Sheet1")
  Set Found = .Range("A1:AB1").Find("coursename", LookIn:=xlValues, lookat:=xlWhole, searchformat:=False)
  If Not Found Is Nothing Then
    Set FirstFound = Found
    Do
      LRow = .Cells(.Rows.Count, Found.Column).End(xlUp).Row
      .Range(.Cells(2, Found.Column), .Cells(LRow, Found.Column)).Copy
      .Cells(.Rows.Count, "A").End(xlUp).Offset(1).PasteSpecial xlPasteValues
      Set Found = .Range("A1:AB1").Find(what:="coursename", after:=Found, LookIn:=xlValues, lookat:=xlWhole, searchformat:=False)
    Loop Until Found Is Nothing Or Found.Address = FirstFound.Address
  End If
End With
End Sub
Reply With Quote