View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Using variables when copying values between worksheets

With Sheets("Sheet2")
Worksheets("Sheet1").Cells(5,12).Copy
.Range(.Cells(8, EmptyColumn), .Cells _
(8,EmptyColumn+1).PasteSpecial Paste:=xlPasteFormats
.Range(.Cells(8, EmptyColumn), .Cells _
(8,EmptyColumn+1).PasteSpecial Paste:=xlPasteValues
End With

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
Hello! I am trying to copy values between two worksheets. On the
second worksheet I want to allow users to be able to see scenarios asa
the numbers change. So when the user clicks a command button for the
first copy we have original values. For the second copy the values
will be different. Yet I am having a problem that I can't seem to
capture only the value. I read that PasteSpecial should do the trick
... yet I am using variables to pass the columns that I happen to be
working with.

With the following I get an error. Any tips or clues? Thanks in
advance.

Worksheets("Sheet1").Cells(5,12).Copy
Sheets("Sheet2").Range(Cells(8, EmptyColumn), Cells
_(8,EmptyColumn+1).PasteSpecial Paste:=xlPasteFormats
Sheets("Sheet2").Range(Cells(8, EmptyColumn), Cells
_(8,EmptyColumn+1).PasteSpecial Paste:=xlPasteValues