Hi guys,
There are plenty of google hits for people copy-pasting in VBA but actually wanting 'paste special as values'; my problem is the opposite and I'm totally flummoxed.
This:
Sub New_Lines()
Dim iLRow As Integer
Application.EnableEvents = False
Columns.Hidden = False
Cells.AutoFilter
iLRow = Range("A1").End(xlDown).Row
Range("querytable").AutoFilter 1, "QXY"
Range(Rows(2), Rows(2).End(xlDown)).Copy Cells(iLRow + 1, 1)
Range(Cells(iLRow + 1, 1), Cells(Rows.Count, 1)).Replace "QXY", "QXY revised", xlWhole
Application.EnableEvents = True
End Sub
is meant to filter my raw data table, duplicate a certain set (QXY) and 'rename' them (as QXY revised) so that I can see how adjustments to the data would look without losing the original.
But sometimes the copy command pastes values (this afternoon, for example) and sometimes formulae. (I definitely need the formulae). I'm probably being a total div, but I can't work out for the life of me what the cause is.
My last resort is simply to break the copy over two lines and paste special 'all' - but I know this is a weak man's workaround
and I'd like to know the cause for the sake of predictability/manageability.
Any help gratefully received.
CC
PS - on further inspection, it would seem the "default paste is as values" is not limited to the VBA - I also lose the formulae if I copy/paste manually. So perhaps my question should be "why is my copy/paste broken?"
Bookmarks