Excel VBA not working for everyone

john_r

New Member
Joined
Feb 15, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi,
I hope someone can help me figure this out:
I created a macro for excel that handles some data manipulations.
I am located in the USA. The new user of the file with the macro is located in Europe (no idea if it has any impact, but figured I include it)

When I run the macro, it runs smooth and without any issues.
However, when the other user runs the macro, it falls into error at the weirdest and never the same spot.
It can't select a sheet or it can't activate a set workbook, can't open a named file.

Does anyone have any idea why the code would work differently for me, as it does someone else.
We tried it many times using screen share. and the code never seems to error out on the same spot.

Are there excel or regional settings to check that could have an impact on this?

Appreciate your help
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
It hard to say without seeing the code, but one thought is that in Europe, semi-colons replace commas in formulas.
 
Upvote 0
It hard to say without seeing the code, but one thought is that in Europe, semi-colons replace commas in formulas.
Here is part of the code. I am not a programmer, just an amateur:
However, when I run the routine on my machine, it runs just fine, nothing fails.
When he runs the routine, the macro gets stuck on different lines, each time you reset.
For instance, on unhiding the LE List. Next time it could be the GL_List that is the issue, or it can't open the workbook.

Sub Update_Exposure()

Set AW = ActiveWorkbook

Sheets("LE List").Visible = True
Sheets("SAP Extract").Visible = True
Sheets("GL_List").Visible = True


Sheets("LE List").Range("A1:F100").ClearContents
Sheets("SAP Extract").Columns("A:R").ClearContents
Sheets("Summary Exposures").Range("A12:M5000").EntireRow.Delete


sPath = Sheets("Summary Exposures").Range("C2").Value
sFile_LE = Sheets("Summary Exposures").Range("C6").Value
sFile_FD = Sheets("Summary Exposures").Range("C8").Value
sFile_MA = Sheets("Summary Exposures").Range("C10").Value

FileToOpen = sPath & sFile_LE

Workbooks.Open Filename:=FileToOpen
Set LW = ActiveWorkbook
Columns("A:F").Select
Selection.Copy
AW.Activate
Sheets("LE List").Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
LW.Close SaveChanges:=False
Sheets("LE List").Select
LRL = Sheets("LE List").Cells(1, 1).End(xlDown).Row()
SelectRange = Cells(2, 1).Address & ":" & Cells(LRL, 1).Address
Cells(2, 1).FormulaR1C1 = "=VALUE(RC[1])"
Cells(2, 1).Copy
Range(SelectRange).PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Range(SelectRange).Copy
Range(SelectRange).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False


FileToOpen = sPath & sFile_MA

Workbooks.Open Filename:=FileToOpen
Set MW = ActiveWorkbook
Columns("A:C").Select

Selection.Copy
AW.Sheets("GL_List").Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
MW.Close SaveChanges:=False
LGL = Sheets("GL_List").Cells(1, 2).End(xlDown).Row()
FileToOpen = sPath & sFile_FD
Workbooks.Open Filename:=FileToOpen
Set FW = ActiveWorkbook
Columns("A:M").Select
Selection.Copy
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,857
Members
449,051
Latest member
excelquestion515

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