sblair9691
New Member
- Joined
- Dec 16, 2021
- Messages
- 1
- Office Version
- 365
- 2010
- Platform
- Windows
Hi All,
I am currently using code to split data from a single column (copied from pdf) to separate columns for easy reading. There are over 5000 entries within the spreadsheet and it is slow to complete the macro. Does anyone have any tips for speeding this up or using powerquery instead? I've attached an output example and the code.
Thank you in advance.
My Code:
What i want to happen:
I am currently using code to split data from a single column (copied from pdf) to separate columns for easy reading. There are over 5000 entries within the spreadsheet and it is slow to complete the macro. Does anyone have any tips for speeding this up or using powerquery instead? I've attached an output example and the code.
Thank you in advance.
My Code:
VBA Code:
Sub SelectBetween()
Dim LastRow As Long, i As Long
Dim x As Long
Dim y As Long
x = 1
y = 2
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To LastRow
i = 1
Dim findrow As Long, findrow2 As Long
findrow = Range("A:A").Find("Animal", Range("A1")).Row
findrow2 = Range("A:A").Find("Animal", Range("A" & findrow)).Row
Range("A" & findrow & ":A" & findrow2 - 1).Select
Selection.Cut
Cells(x, y).Select
y = y + 1
ActiveSheet.Paste
Next i
End Sub
What i want to happen:
Animal | Animal | Animal | Animal | Animal | |
Dog | Dog | Dog | Cat | Cat | |
Cat | Cat | Ardvark | Pigeon | ||
Person | Person | Dog | |||
Animal | |||||
Dog | |||||
Animal | |||||
Cat | |||||
Ardvark | |||||
Dog | |||||
Animal | |||||
Cat | |||||
Pigeon | |||||
Animal |