Aug 19 2021 08:53 AM
I'm using the below code to find the last row, then autofill column A.
LR = Cells(Rows.Count, 4).End(xlUp).Row
Range("A2").AutoFill Destination:=Range("A2:A" & LR)
It works unless there is only one value in column 4 (D2). If there are no values in D2 or if there is more than one value in column D (D2:D3... D2:D2000) the formula works.
What do I need to do if there is only one value in column D (D2)?
Row A1:E1 are column heads.
Tank you for your help!
Aug 19 2021 09:26 AM
SolutionFor example:
LR = Cells(Rows.Count, 4).End(xlUp).Row
If LR <> 2 Then
Range("A2").AutoFill Destination:=Range("A2:A" & LR)
End If
Aug 20 2021 08:32 AM
Aug 19 2021 09:26 AM
SolutionFor example:
LR = Cells(Rows.Count, 4).End(xlUp).Row
If LR <> 2 Then
Range("A2").AutoFill Destination:=Range("A2:A" & LR)
End If