Thanks for the help. But the code copies the first and the last data row of column "Q" to Q1 & Q2.
Also it copies the row 17 value of any column where data exists to the row 1 of that column.
How shall I avoid this?
Public Sub CopyFirstLast()
Range("Q16").End(xlDown).Copy Destination:=Range("A1")
Range("Q" & Rows.Count).End(xlUp).Copy Destination:=Range("B1")
End Sub
Public Sub CopyFirstLast()
If Range("Q17") = "" Then
Range("Q16").End(xlDown).Copy Destination:=Range("A1")
Else
Range("Q17").Copy Destination:=Range("A1")
End If
Range("Q" & Rows.Count).End(xlUp).Copy Destination:=Range("B1")
End Sub