VBA / MACRO Integrity

UFGATORS

Board Regular
Joined
Nov 28, 2008
Messages
136
Office Version
  1. 365
Hello All, I ws wondering if someone can tell me why when I email a workbook with vba and macros some times they work and sometimes they don't. I set the security levels as low as they can go and still sometimes they work and some times they don't. Below is the VBA code that is in the workbook, I have it pasted in the individual worksheets.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim aCell As Range

If Not Intersect(Range("G3:AK190"), Target) Is Nothing Then
For Each aCell In Target

If UCase(Range("F" & aCell.Row)) <> "N" And UCase(Range("F" & aCell.Row)) <> "Y" Then
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
Exit Sub
End If

If Application.WorksheetFunction.IsText(aCell.Value) Then
If UCase(aCell.Value) = "BH" Then
If UCase(Range("F" & aCell.Row)) = "N" Or _
Cells(192, aCell.Column) < 0.9 Then
Application.EnableEvents = False
aCell.Value = 0
Application.EnableEvents = True
End If
End If
End If

Next aCell
End If

End Sub


Any suggestions for emailing workbooks to ensure it works properly when received?
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
You posted this in the 'other languages' forum. If you are posting a question in English, and want a reply in English, then you should post it in the 'excel questions' forum. You're more likely to get a reply there.

I've moved this to 'excel questions'. :)
 
Upvote 0
As for an answer :

The macro setting is on your machine. You can't change the setting on another users machine. So if your recipient has disabled macro's then this won't work. Macro Security is set on the excel application, not the specific workbook.

If your user has enabled macros, perhaps EnableEvents is turned off. On their machine, in the VBE immediate window type:
Code:
Application.EnableEvents = True
and hit ENTER.
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,259
Members
449,075
Latest member
staticfluids

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