Open and run macro in a SharePoint file

Sherilyne

New Member
Joined
Jun 20, 2016
Messages
9
Hi! I need your help to understand why my macro is not working whenever I open a SharePoint file. Note that the SharePoint is synced in my laptop and and when I run my macro, my SharePoint file is open as Read Only.

Below is may code:
Sub FormatFiles()
Dim ws As Worksheet
Application.DisplayAlerts = False
Application.ScreenUpdating = False


Name1 = ActiveWorkbook.Name


Path1 = "C:\Users" & RB1 & "\KNIME_DEPLOYMENT\workspace\Gross Contribution\02 INPUT FILES"


'Working File
Filename1 = "Asia_HQ_FA_Reporting_Deck" & ".xlsm"


Workbooks.Open Filename:=Path1 & Filename1
Workbooks("Asia_HQ_FA_Reporting_Deck.xlsm").Activate
For Each ws In ActiveWorkbook.Worksheets
If Left(ws.Name, 18) = "Country Financials" Then
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.Replace What:="N/A", Replacement:="0", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="#DIV/0!", Replacement:="0", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="#REF!", Replacement:="0", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Range("L9:AZ73").Select
Selection.Replace What:="MM", Replacement:="000000", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Range("L9:AZ73").Select
Selection.Replace What:="$", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
Next


ActiveWorkbook.Save
ActiveWorkbook.Close


MsgBox "Formatting is complete. Please open your KNIME WORKFLOW."


End Sub
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,224,825
Messages
6,181,191
Members
453,021
Latest member
pingpong7117

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