+ Reply to Thread
Results 1 to 4 of 4

Copied working macro to new workbook, but no longer working

  1. #1
    Registered User
    Join Date
    09-21-2012
    Location
    Las Vegas
    MS-Off Ver
    Excel 2007
    Posts
    36

    Copied working macro to new workbook, but no longer working

    I have a macro that is working in one sheet, and after copying it and making a few path changes it should have been working. However some of it is not, can someone please check this out and let me know if they see anything wrong?

    I have bolded the part that is not working.



    WORKING MACRO:

    Sub MacrosNew1()
    Range("A3:L5000").Select
    Selection.Copy
    Sheets("SALE").Select
    Range("A3").Select
    ActiveSheet.Paste
    Sheets("GTS").Select
    Application.CutCopyMode = False

    Range("P3:P5000").Select
    Selection.Copy
    Sheets("SALE").Select
    Range("M3").Select
    ActiveSheet.Paste
    Sheets("GTS").Select
    Application.CutCopyMode = False

    Range("S3:U5000").Select
    Selection.Copy
    Sheets("SALE").Select
    Range("O3").Select
    ActiveSheet.Paste
    Sheets("GTS").Select
    Application.CutCopyMode = False



    Range("W3:X5000").Select
    Selection.Copy
    Sheets("SALE").Select
    Range("S3").Select
    ActiveSheet.Paste
    Sheets("GTS").Select
    Application.CutCopyMode = False


    Dim i, LastRow

    LastRow = Sheets("SALE").Range("B" & Rows.Count).End(xlUp).Row
    Sheets("DEL").Range("A2:S5000").ClearContents
    For i = 1 To LastRow
    If Sheets("SALE").Cells(i, "B").Value = "DELHI" Then
    Sheets("SALE").Cells(i, "B").EntireRow.Copy Destination:=Sheets("DEL").Range("A" & Rows.Count).End(xlUp).Offset(1)
    End If

    Next i
    ThisWorkbook.Activate
    Worksheets("DEL").Activate
    Columns("A:T").Select
    Selection.Copy


    Workbooks.Open Filename:="C:\users\admin\Dropbox\GTS DEL 2017.xlsm"
    Sheets("DEL").Activate
    Range("A1").Select
    ActiveSheet.Paste
    ActiveWorkbook.Save
    ActiveWorkbook.Close

    ThisWorkbook.Activate
    Worksheets("SALE").Activate
    Range("A3:T5000").Select
    Selection.Copy

    Workbooks.Open Filename:="C:\users\admin\OneDrive\GTS HK 2017.xlsm"
    Sheets("HK").Activate
    Range("A3").Select
    ActiveSheet.Paste
    ActiveWorkbook.Save
    ActiveWorkbook.Close


    ThisWorkbook.Activate
    Sheets("DEL").Select
    Sheets("SALE").Select
    Application.CutCopyMode = False



    End Sub


    NON WORKING MACRO:


    Sub MACROSNEW()

    Range("A3:L5000,Q3:U5000,W3:AB5000").Select
    Selection.Copy
    Sheets("SALE").Select
    Range("A3").Select
    ActiveSheet.Paste




    Dim i, LastRow

    LastRow = Sheets("SALE").Range("B" & Rows.Count).End(xlUp).Row
    Sheets("DEL").Range("A3:W5000").ClearContents
    For i = 1 To LastRow
    If Sheets("SALE").Cells(i, "B").Value = "DELHI" Then
    Sheets("SALE").Cells(i, "B").EntireRow.Copy Destination:=Sheets("DEL").Range("A" & Rows.Count).End(xlUp).Offset(1)

    End If
    Next i

    ThisWorkbook.Activate
    Worksheets("DEL").Activate
    Range("A3:W5000").Select
    Selection.Copy


    Workbooks.Open Filename:="C:\users\admin\OneDrive\vamsa.xlsm"
    Sheets("SALE").Activate
    Range("A3").Select
    ActiveSheet.Paste
    ActiveWorkbook.Save
    ActiveWorkbook.Close

    ThisWorkbook.Activate
    Sheets("DEL").Select
    Application.CutCopyMode = False


    End Sub

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474

    Re: Copied working macro to new workbook, but no longer working

    You haven't said what was not working,

    You can edit your code to add the code tags,

    AA CodeTags.jpg

  3. #3
    Registered User
    Join Date
    09-21-2012
    Location
    Las Vegas
    MS-Off Ver
    Excel 2007
    Posts
    36

    Re: Copied working macro to new workbook, but no longer working

    Hi,

    I already had bolded the part of the macro that wasnt working.

    Thank you

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Copied working macro to new workbook, but no longer working

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. From Excel working to Google Sheets no longer working
    By rad1964 in forum Excel General
    Replies: 5
    Last Post: 07-19-2016, 10:23 PM
  2. Macro No Longer Working
    By ukbumpkin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-27-2016, 11:04 AM
  3. Query on VBA macro no longer working
    By stephen.m.brown in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-25-2013, 12:12 PM
  4. [SOLVED] Macro no longer working?
    By Margate in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-04-2013, 02:26 PM
  5. Sub copied from one workbook to second not working
    By jdfjab in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-07-2012, 07:24 AM
  6. Workbook no longer working
    By LRose in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-08-2011, 10:26 PM
  7. Macro no longer working - Don Guillett
    By tanyhart in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-11-2006, 01:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1