ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Worksheet.Copy Expected Function or Variable Error (https://www.excelbanter.com/excel-programming/399508-worksheet-copy-expected-function-variable-error.html)

Lazzaroni

Worksheet.Copy Expected Function or Variable Error
 
This seems fairly straight forward to me, yet it produces a compile error:
"Expected Function or variable."

Dim oOldSheet As Worksheet
Dim oNewSheet As Worksheet

Set oOldSheet = ActiveSheet

Set oNewSheet = oOldSheet.Copy(oOldSheet)

Any suggestions? Thanks.

Dave Peterson

Worksheet.Copy Expected Function or Variable Error
 
I'd use:

Dim oOldSheet As Worksheet
Dim oNewSheet As Worksheet

Set oOldSheet = ActiveSheet

oOldSheet.Copy after:=oOldSheet
Set oNewSheet = ActiveSheet



Lazzaroni wrote:

This seems fairly straight forward to me, yet it produces a compile error:
"Expected Function or variable."

Dim oOldSheet As Worksheet
Dim oNewSheet As Worksheet

Set oOldSheet = ActiveSheet

Set oNewSheet = oOldSheet.Copy(oOldSheet)

Any suggestions? Thanks.


--

Dave Peterson


All times are GMT +1. The time now is 07:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com