Hi Joe!
Can you identify the range you want to select as a named range and just copy that instead? One caveat, you want to be careful inserting/deleting with a named range when ever you insert or delete along the "edges". If the row/colum you are inserting is not between the top/bottom/right/left boundaries the insert might not be considered to be part of the named range you are dealing with.
Just a thought,
Tuc
Hi Joe,
I just learned that the other day while reading my copy of "Excel2000 Programming for Dummies." This will work in Excel97 as well.
Redo you macro, but this time select a range (any range) BEFORE starting the macro. Then start the recording.
In the example written in the book (by John Walkenbach), he was illustrating converting all formulas to static info (similar in function to Paste Special).
Seeing as he had already selected the range before starting the recording of the macro, the first line in the code read:
Selection.Copy
Note that no range is specified. It is probably illegal for me to reproduce the rest of the code here, but this should be enough of a clue to get your started.
Kevin
Almost forgot...
So the next time you need to USE your macro, you would first select the range you want and THEN run the macro.
Kev
Hi Joe
Here is how you can copy a variable range. If it's not quite what you need, give me some more details and I'll modify it.
Sub TryThis()
'Copy to last row
Range("A1", Range("A65536").End(xlUp)).Copy
End Sub
Sub TryThis()
'Copy to first blank row
Range("A1", Range("A1").End(xlDown)).Copy
End Sub
Dave
OzGrid Business Applications