Bill_Biggs
Well-known Member
- Joined
- Feb 6, 2007
- Messages
- 1,216
I have a macro that processes one or more sheets of data. At one point it finds a certain column, copies the occupied cells in the column, selects column A, and inserts the copied column here.
Here is that portion of the macro:
Cells.Find(What:="CpuFNode*:MemClkFreq", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
ActiveCell.Select
Range(Selection, Selection.End(xlDown)).Copy
Columns("A:A").Select
Selection.Insert Shift:=xlToRight
The first time through, the macro performs flawlessly. But the second time through, the new column is pasted all the way down the column, using all 65000 rows and not just the 20-150 cells that it did microseconds before.
Has anyone seen odd behavior like this before? Is there something I can do to remedy it?
Thanks,
Bill Biggs
Here is that portion of the macro:
Cells.Find(What:="CpuFNode*:MemClkFreq", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
ActiveCell.Select
Range(Selection, Selection.End(xlDown)).Copy
Columns("A:A").Select
Selection.Insert Shift:=xlToRight
The first time through, the macro performs flawlessly. But the second time through, the new column is pasted all the way down the column, using all 65000 rows and not just the 20-150 cells that it did microseconds before.
Has anyone seen odd behavior like this before? Is there something I can do to remedy it?
Thanks,
Bill Biggs