Button slows down macro

Perbjo

New Member
Joined
May 5, 2022
Messages
30
Office Version
  1. 365
Platform
  1. Windows
Hi

This is an old subject thats been discussed several times, I know, but I'm still struggling...

I've made a formular that when its filled in is copy/paste from a button to a new sheet.
It runs like a charm from VBE, but when I use a button to do the job, Excel slows down with menus grayed out.
I just can't figure out, how to fix this.
Hopefully some of you know, what to do.
I'm quite new to VBA so please be detailed in explanation :)

Here is my macro:

Sub TestNytProjektNytArk04()
'Workbooks("TestHastighedNytProjekt.xlsm").
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False

Worksheets("Forside").Range("B3:C11").Copy 'the button appear on the sheet "Forside"
Sheets.Add after:=ActiveSheet
Range("B3").PasteSpecial Paste:=xlPasteAll
Columns("B:B").EntireColumn.AutoFit
Columns("C:C").EntireColumn.AutoFit
Range("B14").Select 'I select a cell to make the gray color from the paste function dissapear
Sheets("Forside").Select 'I select this page again to cancel the copy function
Application.CutCopyMode = False

Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True

End Sub
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
I have tested your code 3 ways. Once using the VBE, once using an ActiveX button and once using a Form Control button. The code works fine all three ways. Whatever issues you are experiencing, I do not think it is a function of how you call the code.
 
Upvote 0
I have tested your code 3 ways. Once using the VBE, once using an ActiveX button and once using a Form Control button. The code works fine all three ways. Whatever issues you are experiencing, I do not think it is a function of how you call the code.
Thanks for trying, igold.
Unfortunately I still can't get it to work. If I run the macro from VBE once, then it, sometimes, will run fine from the button. Thats really weird.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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