+ Reply to Thread
Results 1 to 8 of 8

2010 Macro not working in 2016 Excel

Hybrid View

  1. #1
    Registered User
    Join Date
    08-22-2014
    Location
    Monterrey
    MS-Off Ver
    2010
    Posts
    43

    2010 Macro not working in 2016 Excel

    Up until yesterday, I was working with Excel 2010. Today I up graded to Excel 2016, but now one of my macros is not working properly.

    The Macro's function is to copy data from 12 cells from one sheet to anotherone, and it's attached to a button. When I "click" on the button, only the first two pieces of information make it to the next sheet. The Macro continues to run, jumping from sheet to sheet, but leaving blank cells. The funny part is that this only happens when I run the Macro from the button, if I do it directly from the developer tab, it runs perfectly.

    I all ready deleted the button and re-assigned the the macro to a new one, but it still doesn't work. I also reviewed the Macro on VBA, and there's no difference in the way the instructions are written for the first two items and the rest of them.

    Any ideas as to what's going on and how to fix it?

    Thanks

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: 2010 Macro not working in 2016 Excel

    Hi,

    Can you post the macro code here?
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Registered User
    Join Date
    08-22-2014
    Location
    Monterrey
    MS-Off Ver
    2010
    Posts
    43

    Re: 2010 Macro not working in 2016 Excel

    Sub Copycopy()
    'Ventas
    Range("J210").Copy
    With Sheets("Evaluación").Range("d" & Rows.Count).End(xlUp).Offset(1, 0)
    .PasteSpecial Paste:=xlPasteValues
    End With
    
    Range("k210").Copy
    With Sheets("Evaluación").Range("d" & Rows.Count).End(xlUp).Offset(0, 1)
    .PasteSpecial Paste:=xlPasteValues
    End With
    
    'Unidades
    Range("J211").Copy
    With Sheets("Evaluación").Range("d" & Columns.Count).End(xlUp).Offset(0, 2)
    .PasteSpecial Paste:=xlPasteValues
    End With
    
    Range("k211").Copy
    With Sheets("Evaluación").Range("d" & Columns.Count).End(xlUp).Offset(0, 3)
    .PasteSpecial Paste:=xlPasteValues
    End With
    
    'Precios
    Range("J212").Copy
    With Sheets("Evaluación").Range("d" & Columns.Count).End(xlUp).Offset(0, 4)
    .PasteSpecial Paste:=xlPasteValues
    End With
    
    Range("k212").Copy
    With Sheets("Evaluación").Range("d" & Columns.Count).End(xlUp).Offset(0, 5)
    .PasteSpecial Paste:=xlPasteValues
    End With
    
    'CM$
    Range("J213").Copy
    With Sheets("Evaluación").Range("d" & Columns.Count).End(xlUp).Offset(0, 6)
    .PasteSpecial Paste:=xlPasteValues
    End With
    
    Range("k213").Copy
    With Sheets("Evaluación").Range("d" & Columns.Count).End(xlUp).Offset(0, 7)
    .PasteSpecial Paste:=xlPasteValues
    End With
    
    'Var$
    Range("J214").Copy
    With Sheets("Evaluación").Range("d" & Columns.Count).End(xlUp).Offset(0, 8)
    .PasteSpecial Paste:=xlPasteValues
    End With
    
    Range("k214").Copy
    With Sheets("Evaluación").Range("d" & Columns.Count).End(xlUp).Offset(0, 9)
    .PasteSpecial Paste:=xlPasteValues
    End With
    
    'Var Real$
    Range("J215").Copy
    With Sheets("Evaluación").Range("d" & Columns.Count).End(xlUp).Offset(0, 10)
    .PasteSpecial Paste:=xlPasteValues
    End With
    
    Range("k215").Copy
    With Sheets("Evaluación").Range("d" & Columns.Count).End(xlUp).Offset(0, 11)
    .PasteSpecial Paste:=xlPasteValues
    End With
    
    Range("j216").Copy
    With Sheets("Evaluación").Range("d" & Columns.Count).End(xlUp).Offset(0, 21)
    .PasteSpecial Paste:=xlPasteValues
    End With
    
    
    
    End Sub
    Last edited by porepiga; 04-18-2017 at 11:28 AM.

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: 2010 Macro not working in 2016 Excel

    Why are you using Columns.Count in all the blocks after the first two? They should all be Rows.Count

  5. #5
    Registered User
    Join Date
    08-22-2014
    Location
    Monterrey
    MS-Off Ver
    2010
    Posts
    43

    Re: 2010 Macro not working in 2016 Excel

    The code works fine, still, I tried your suggestion. The question here is why does it run directly crom the Developer on the reibbon, but not from the button it's linked to.

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: 2010 Macro not working in 2016 Excel

    Please note that your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE] [/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)
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  7. #7
    Registered User
    Join Date
    08-22-2014
    Location
    Monterrey
    MS-Off Ver
    2010
    Posts
    43

    Re: 2010 Macro not working in 2016 Excel

    Done!!! Thank you!

  8. #8
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: 2010 Macro not working in 2016 Excel

    I cannot say why it works from one location and not another- I would need to see the workbook. If you do not receive an error, the macro must be copying something to a location each time, but it may not be the location you expect. In any event, using Columns.Count made no sense.

+ 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. Opening Excel 2010 in 2016 causes double images
    By tlshook in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-28-2016, 12:48 PM
  2. dlg macro not working on 2016
    By culebrasx in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-29-2016, 11:43 AM
  3. [SOLVED] Code not working in Office 2010 and Office 2016
    By amitmodi_mrt in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-21-2016, 02:48 PM
  4. Replies: 0
    Last Post: 05-17-2016, 12:39 PM
  5. Replies: 2
    Last Post: 05-17-2016, 12:23 PM
  6. Macro From Excel 2013 Not Working in 2016
    By tm1238 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-08-2016, 04:39 PM
  7. Macro not working in Excel 2010 but working in Excel 2003
    By mvel_sky in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-02-2013, 04:18 PM

Tags for this Thread

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