question about syntax in a simple macro...

G

Guest

I just recorded the following macro:

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 11/3/2006 by df78700
'

'
Cells.Select
Range("A8").Activate
Selection.Copy
Workbooks.Add
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub

I'm trying to select the entire worksheet and then create a new workbook and
paste all the cell values (not formulas) into that new workbook. This seems
to work fine, however, Range("A8") confuses me: obviously the range of an
entire XL worksheet is not one cell!

What am I missing here?
 
D

Don Guillett

try
Cells.Copy
Workbooks.Add
Selection.PasteSpecial Paste:=xlPasteValues
End Sub
 
E

Earl Kiosterud

Dave,

This is about activating a cell and selecting cells. Lots of cells can be
selected, but only one, the white one, is active. You've activated A8, but
a selection has never been made So without a selection, the Copy method puts
all the cells on the clipboard. If you add something like
Range("A7").Select first, then Range("A8").Activate will also select A8, and
your macro will copy/paste only A8. Better yet, change Range("A8).Activate
to Range("A8").Select.
 
D

Dana DeLouis

Hi.

ActiveSheet.Copy

Will copy the sheet to a new Workbook.

If you select a small area, you will see that 1 cell is always "active,"
even though you have selected more than 1 cell.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top