I understood the code but need to test it to see whether it is fool proof.
I though of using COUNTA/Resize to check if the user inputs a invalid number. In such case, there would be no entries in the column. So COUNTA will be nothing/zero excluding the column heading.
But unfortunately, if no matches ,OK in the filter is disable therefore no empty rows will show up.
So I had to test your code. It worked flawless! The code also handles errors.
How does it switch between Source and Output workbooks without using windows activate. We set the workbook names so that does the trick?
Assigning string to a prompt is creative I did not know that.
Also DataBodyRange is good. I don't have to worry about offset anymore just input the column number cuz it will exclude the header anyway.
I have some general question and one additional requirement.
1.) What is a list object. I have checked it in the object browser ListObject is part of Worksheet and TableObject class. I don't see any syntax.
2.) Is vbCrLf same as vbNewLine? I guess it is.
3.) I see no variables being passed or sub being called. Function Validate is public. It jumps to function validate procedure to validate myInp while debugging.
In the code below:
What is rngToFind?
If rngToFind = Nothing means no match found is True Exit Do? if Fasle loop (since validate function is a Boolean)
In the Find arguments what is xlValues, xlWhole, xlByRows, xlNext is default I see in syntax MatchCase Fasle implies?
With rngToSearch
Set rngToFind = .Find(What:=varToFind, \_
LookIn:=xlValues, \_
LookAt:=xlWhole, \_
SearchOrder:=xlByRows, \_
SearchDirection:=xlNext, \_
MatchCase:=False)
If Not rngToFind Is Nothing Then
Validate = True
Else
Validate = False
End If
End With
Instead of selecting the range to be copied, I have used code to reference the required column of data in the table rather than select and end down etc.
code to reference is above with statement?
Lastly, After copying it in to wsOutput sheet (see screenshot)
I want to find the last row starting from A4 or N4 doesn't matter all have the same last row.
Then For each cell in O4, P4 and Q4 to last row in the sheet
I want to fill
O4 to last row with "Location" (New York will be hardcoded in the code)
P4 to last row with TodaysDate (06-Mar-2021)
Q4 to last row with C
and have all boarders only to the filled cells.
