ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy command (https://www.excelbanter.com/excel-programming/332507-copy-command.html)

browie

Copy command
 
Hi all
I am looking for a macro to lookup up a number in cell d5 on worksheet
"ladderprint"

If for example this cell has "11" in it , I want it to copy the whole
worksheet to sheet "ladder 11".

Is this possible?

Thanks



K Dales[_2_]

Copy command
 
Dim SheetName As String, NewSheet As Worksheet

SheetName = "ladder " & Worksheets("ladderprint").Range("D5").Value
Worksheets("ladderprint").Cells.Copy
On Error GoTo MakeSheet
Set NewSheet = Worksheets(SheetName)
NewSheet.Cells.PasteSpecial xlPasteAll ' or xlPasteValues if you only want
values, etc.
Application.CutCopyMode = False
Exit Sub

MakeSheet:
Set NewSheet = Worksheets.Add()
NewSheet.Name = SheetName
NewSheet.Cells.PasteSpecial xlPasteAll ' or xlPasteValues if you only want
values, etc.
Application.CutCopyMode = False

"browie" wrote:

Hi all
I am looking for a macro to lookup up a number in cell d5 on worksheet
"ladderprint"

If for example this cell has "11" in it , I want it to copy the whole
worksheet to sheet "ladder 11".

Is this possible?

Thanks





All times are GMT +1. The time now is 02:04 PM.

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