Macro From Excel 2010 Not Working the Same in 2016

clydefrog

New Member
Joined
Mar 27, 2017
Messages
7
Hi! So we recently switched form excel 2010 to 2016 (finally) and my macros are now working differently. I assume this may be a known issue, but I haven't been able to find the best info when searching online.

So here is the specific issue:

My macro is performing 3 actions I guess you could say. The way my macro was originally working in 2010 was it knew to stay on the same page and perform all 3 actions. However, now it seems as if it is jumping to the other tabs and trying to grab the information from those tabs instead. I have found that if I specifically tell the macro to go back to the "Chipping" tab by writing Sheet("CHIPPING").Select before each of the last 2 sections of my macro to copy range AH6:AT22 and copy range F12 then the macro works. Is it necessary to do this now in 2016 for all of my macros or is there something else going on that would be a better way to fix this. Below is the macro. Thank you in advance for any advice you can give me.

Sub Copy_Chipping_to_Summary_Tab()
'
' Copy_Chipping_to_Summary_Tab Macro
'

'
Dim WhatColumn As Long
Dim Summary As Worksheet
Dim Cel As Range

WhatColumn = 1 'Column A
NowColumn = 6
LastColumn = 11
Set Summary = Sheets("Summary")

Range("V5:Y16").Copy

If Summary.Cells(Rows.Count, WhatColumn).End(xlUp).Offset(2).Row > 57 Then
WhatColumn = NowColumn 'Now column E - next I
End If

If Summary.Cells(Rows.Count, NowColumn).End(xlUp).Offset(2).Row > 57 Then
WhatColumn = LastColumn
End If

Set Cel = Summary.Cells(Rows.Count, WhatColumn).End(xlUp).Offset(2)
Cel.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Cel.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False

Range("AH6:AT22").Copy
Set Cel = Sheets("DTS").Cells(Rows.Count, 1).End(xlUp).Offset(2)
Cel.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Cel.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False

Range("F12").Copy
Set Cel = Sheets("Notes").Cells(Rows.Count, 19).End(xlUp).Offset(1)
Cel.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

End Sub
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top