Macros not working on other computers

nelsonvivar

New Member
Joined
Sep 30, 2016
Messages
17
Hello,

I just need your help regarding my concerns too. I have a macro code that works in my laptop but not work in others laptop.

I've instructed them to check these settings in their Trust Center....
Macro Settings - check-mark the "Enable All Macros"
Macro Settings - check-mark the "Trust Access to the VBA project
object model" (whatever that is?)
Message Bar - select the "Show the Message Bar in all applications
when content has been blocked"

And still no luck.

Here are my codes. Hope you help me.


Sub GENLYPaste_Auto_Open()


Dim Month As String
Dim myCopy As String
Dim password As String

Month = Worksheets("Setup").Range("F8").Value
myCopy = "J2:J2041"
password = "APAccounting"

If Month = "31/01/2018" Then
With Sheets("2017TB")
.Unprotect password:=password
Worksheets("GCOA").Range("I2:I2041").Copy
If Worksheets("2017TB").Range("I2103").Value = 1 Then
MsgBox "Selected month already generated!"
Else
Worksheets("2017TB").Range("H2").PasteSpecial xlPasteValues
End If
.Protect password:=password
End With

With Sheets("2017TB")
.Unprotect password:=password
Worksheets("GCOA").Range(myCopy).Copy
If Worksheets("2017TB").Range("I2103").Value = 1 Then
MsgBox "Selected month already generated!"
Else
Worksheets("2017TB").Range("I2").PasteSpecial xlPasteValues
End If
.Protect password:=password
End With

ElseIf Month = "28/02/2018" Then
With Sheets("2017TB")
.Unprotect password:=password
Worksheets("GCOA").Range(myCopy).Copy
If Worksheets("2017TB").Range("J2103").Value = 1 Then
MsgBox "Selected month already generated!"
Else
Worksheets("2017TB").Range("J2").PasteSpecial xlPasteValues
End If
.Protect password:=password
End With

End If
Application.CutCopyMode = False
Application.Goto _
Reference:=Worksheets("TBStat").[A1]


End Sub
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Is your code being stored in the Personal Workbook? If so then the code is on your laptop not others.
 
Upvote 0
hi healey,

Thanks for the feedback.
I've saved it as macro enabled workbook.
In fact it works on other computers but on some it doesn't work. Do you have any reasons for that?
 
Upvote 0
Are you all using the same version of Excel?

Also, you have not explained what you mean by "not working on other computers".
Do they get errors? If so, what exactly are those errors?
Or does it not do anything?

On these computers that it is not working, have you tried stepping through the code on those computers to see what is going on?
 
Upvote 0
Hello Joe,

Thanks for the feedback.
We have the same version of excel.
There is no error that exist on their computer, just does not do anything when clicking the button.

How can i figure out to see what's happening on the codes in these computers?

Thanks for the help
 
Upvote 0
By stepping though your code and watch what happens at each step along the way.
If you have two monitors, have it so your worksheet is on one and the VB Editor is on the other.
Otherwise resize them both so you see one on one side of the screen, and the other on the other side.

Then, select/highlight the first line of code in the VB Editor and press F8 (which runs one line of code).
Keep pressing F8 to process each line of code, and watch what happens to your sheet while you do that.
 
Upvote 0
Thanks Joe.
I try to do your instructions. and found out that the following codes didn't work on other computers.
Do you have any alternatives?

Dim Month As String
Dim myCopy As String
Dim password As String

Month = Worksheets("Setup").Range("F8").Value
myCopy = "J2:J2041"
password = "APAccounting"
 
Upvote 0
Hi Joe,

I already seen the error now. Different computers have different formatting of dates. Thus the date in the code won't work. I've changed now the date into more specific one. It works now.
Thank you!
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,198
Members
452,616
Latest member
intern444

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