michaeljamesellis
New Member
- Joined
- May 29, 2024
- Messages
- 7
- Office Version
- 2021
- Platform
- Windows
I have the following macro which I need to loop until there is no value in the first step (Range ("A2").Select.
Any guidance on how best to achieve this would really be appreciated.
Thank you
Sub Macro7()
'
' Macro7 Macro
'
'
Range("A2").Select
Selection.Copy
Sheets("Raw Data").Select
Columns("D:D").Select
Selection.Find(What:="Company Name", After:=ActiveCell, LookIn:= _
xlFormulas2, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
Range("A1538:C1538").Select
Range("C1538").Activate
Application.CutCopyMode = False
Selection.Copy
Sheets("Ultimate Output").Select
Range("B2").Select
ActiveSheet.Paste
Range("A2:D2").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Ultimate Output (2)").Select
Range("A2").Select
ActiveSheet.Paste
Rows("2:2").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Sheets("Ultimate Output").Select
Rows("2:2").Select
Selection.Delete Shift:=xlUp
Range("A1").Select
End Sub
Any guidance on how best to achieve this would really be appreciated.
Thank you
Sub Macro7()
'
' Macro7 Macro
'
'
Range("A2").Select
Selection.Copy
Sheets("Raw Data").Select
Columns("D:D").Select
Selection.Find(What:="Company Name", After:=ActiveCell, LookIn:= _
xlFormulas2, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
Range("A1538:C1538").Select
Range("C1538").Activate
Application.CutCopyMode = False
Selection.Copy
Sheets("Ultimate Output").Select
Range("B2").Select
ActiveSheet.Paste
Range("A2:D2").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Ultimate Output (2)").Select
Range("A2").Select
ActiveSheet.Paste
Rows("2:2").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Sheets("Ultimate Output").Select
Rows("2:2").Select
Selection.Delete Shift:=xlUp
Range("A1").Select
End Sub