OilEconomist
Active Member
- Joined
- Dec 26, 2016
- Messages
- 439
- Office Version
- 2019
- Platform
- Windows
Thanks in advance for any suggestions as I will post feedback for them.
I am trying to loop through Column A and when the cell does not equal one of the listed items, I would like to copy a section of that data. Here is my code thus far.
I am trying to loop through Column A and when the cell does not equal one of the listed items, I would like to copy a section of that data. Here is my code thus far.
Code:
Sub Macro(1)
'Dimensioning
Dim LastRow As Long
Dim LRPHDW As Long
Dim StartRow As Long
Dim i As Long
'Find the Last Row of all the data
LastRow = Cells.Find(What:="*", after:=Range("A1"), LookAt:=xlPart, _
LookIn:=xlFormulas, SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, MatchCase:=False).Row
'Find the Last Row of this section of data which will be the same length for all _
sections of data that will be copied
LRPHDW = Range("A5").End(xlDown).Offset(1).Row
LRPHDW = LRPHDW - 2
'Loop through Column A to copy the appropriate sections
For i = 1 to LastRow
'I want to loop through column A starting with cell "A1" through "A"&LastRow._
Once the cell in Column A does not equal one of the following, I would like _
copy the data two rows below it going from column B through Column P through _
LRPHDW _
Blank cell _
Left 4 characters will be equal to "Date" _
"Rem." _
Have a date in it with the format "m/d/yyyy" _
'Copy the data
'Copy tab "SheetA" after tab "SheetB" and paste the copied data _
starting in cell B11
End Sub
Last edited: