This Script has Syntax error - I tried to debug but was not successful
Oh sorry forgot the before and after pictures, Here they are. [img alt_text='' description='']http://vbaf1.com/q/wp-content/uploads/2018/04/1-1.jpg[/img]
For this to work please add custom format to format cells. Add 13 zeros as the custom format. See pictures....
[img alt_text='' description='']http://vbaf1.com/q/wp-content/uploads/2018/04/1.jpg[/img] - [img alt_text='' description='']http://vbaf1.com/q/wp-content/uploads/2018/04/2.jpg[/img] [code] Sub CountDateTime() Dim ws1 As Worksheet Set ws1 = Worksheets("Sheet1") Dim ltr...
[img alt_text='' description='']http://vbaf1.com/q/wp-content/uploads/2018/04/organizegrades.jpg[/img] Sub OrganizeGrades() Dim lastrow As Integer Dim lastcol As Integer Dim ws1 As Worksheet Dim ws2...
Dear Sir I tried the same as follows rng.Copy ws2.Cells(Rows.Count, 5).End(xlUp).Offset(1, -2).PasteSpecialxlPasteValues Run Time error is coming : Object...
Thank you for looking into this, sure i will check get back to you.
Hello Krishnan I am not sure which variable contains the vlookup. To resolve this, change the appropriate line below. If...
Hi,
I have used the forum and found ‘Copy Data from one Worksheet to Another in Excel VBA’ which worked fantastic, using the below code:
Sub SAMPLE() Sheets(“Sheet1”).Select Range(“E1:G513”).Select Selection.Copy Sheets(“Sheet2”).Select Range(“A2”).Select ActiveSheet.Paste End Sub
I liked this code as it kept the comments I had inserted on the tabs and copied them to ‘Sheet 2’
What I would like to do, is copy Sheet 1 in exactly the same way, and when running the macro, Save as a new file (acting as a copy).
Can anyone help me please? I only want to save a range of the sheet 1 data, which is why I am not using a macro to save a copy of the sheet.
I did have this code:
Option Explicit
Sub Sample() Dim wbI As Workbook, wbO As Workbook Dim wsI As Worksheet, wsO As Worksheet
‘~~> Source/Input Workbook Set wbI = ThisWorkbook ‘~~> Set the relevant sheet from where you want to copy Set wsI = wbI.Sheets(“Sheet1”)
‘~~> Destination/Output Workbook Set wbO = Workbooks.Add
With wbO ‘~~> Set the relevant sheet to where you want to paste Set wsO = wbO.Sheets(“Sheet1″)
‘~~>. Save the file .SaveAs Filename:=”C:\Desktop\Customer Copy.xlsm”, FileFormat:=56
‘~~> Copy the range wsI.Range(“D1:G515”).Copy
‘~~> Paste it in say Cell A2. Change as applicable wsO.Range(“A2”).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _ SkipBlanks:=False, Transpose:=False End With End Sub
Which saves as a new file which is great, but it looses the inserted comments I had.
Thanks
Not sure if this will help. When you save your file click Tools>General Options and then click on Always create backup. No macro needed to keep a backup of your work.
Save a backup file
PeteMcKinnon
Hi Hyside2 Thank you for the comment, this wont work as I only want to copy selected information, which is why I was using the macro,
The reason for this, is that I have a Master file, and then certain information on a Copy which then means when a colleague or myself update the Master it updates the copy also.
Please share using the share button above.
If you found the answer is best answer for your question, Please mark as 'best answer' by clicking on the right tick mark icon at the left side of the answer.
Found the answer useful and wants to credit the user, then vote the answer (vote up).
By clicking "Sign up" you indicate that you have read and agree to the privacy policy and terms of service.