ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Macro not working properly when the file is shared (https://www.excelbanter.com/excel-worksheet-functions/107702-macro-not-working-properly-when-file-shared.html)

Chakri

Macro not working properly when the file is shared
 
Hi all,

I am encountering a specific scenerio where in I am creating a new file
by copying one of the sheets and renaming that with todays date.
, here starts me problem when I try to share the sheet to work around I
am seeing that th macro is not copying the sheet properly even though i
have given PasteSpecial

The code goes here

Sub Newsheet()
sheetname = Format(Now, "dd-mmm-yyyy")
MsgBox sheetname
sheet_count = Worksheets.Count
'Checking for Replication
Wksnameexists = WorksheetExists(sheetname)
If Wksnameexists = True Then
MsgBox "Sheet exists Cannot Create More than one Instance"
End
Else
r = Sheets(sheet_count).Select(2)
Sheets("Template").Select
Cells.Select
Application.CutCopyMode = False
Selection.Copy
'Adding the Worksheet
Worksheets.Add
ActiveSheet.Name = sheetname
Cells.Select
'Copying the Worksheet
'ActiveSheet.Paste
ActiveSheet.PasteSpecial
Range("A1").Select
End If

End Sub

Please suggest any other scenerio using which i can use the sheet when
its shared.
I tried giving
"ActiveSheet.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False"

I would be very happy for any pointers to resolve this issue



All times are GMT +1. The time now is 08:19 AM.

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