Sharework book with working all VBA code

Jagat Pavasia

Active Member
Joined
Mar 9, 2015
Messages
359
Office Version
  1. 2021
Platform
  1. Windows
hi, dear sir,
I have many VBA code in my worksheet, now i want to share my workbook for 2 Computer. So, the both computer can work on workbook at the same time.
but when i share it, some of VBA code stopped working, any other idea to share workbook with VBA code ?


Please suggest me. My VBA code is Something like below.

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'   Code goes in the Worksheet specific module
    Dim rng As Range
    '   Set Target Range, i.e. Range("A1, B2, C3"), or Range("A1:B3")
        Set rng = Target.Parent.Range("b:b,f:f,m:m")
        '   Only look at single cell changes
            If Target.Count > 1 Then Exit Sub
        '   Only look at that range
            If Intersect(Target, rng) Is Nothing Then Exit Sub
        '   Action if Condition(s) are met (do your thing here...)
            If Target.Value = "**" Then Target.Value = Format(Date, "mm/dd/yyyy")
            
    End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  Application.ScreenUpdating = True
End Sub

Sub ClearAllFilter()
'
' ClearAllFilter Macro
'

'
    ActiveSheet.Unprotect
    On Error Resume Next
    ActiveSheet.ShowAllData
    On Error GoTo 0
    ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
        False, AllowFormattingCells:=True, AllowFiltering:=True
    
End Sub

Private Sub SpinButton1_SpinDown()
On Error Resume Next
Range("b6").Value = Range("b6").Value - 1
End Sub

Private Sub SpinButton1_SpinUp()
On Error Resume Next
Range("b6").Value = Range("b6").Value + 1
End Sub

Sub GhatJama()
'
' GhatJama Macro
'

'
    ActiveSheet.Unprotect
    On Error Resume Next
    ActiveSheet.ShowAllData
    ActiveSheet.Range("$A$5:$R$9000").AutoFilter Field:=6, Criteria1:="<>"
    ActiveSheet.Range("$A$5:$R$9000").AutoFilter Field:=13, Criteria1:="="
    On Error GoTo 0
    ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
        False, AllowFormattingCells:=True, AllowFiltering:=True
        
End Sub
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
some of VBA code stopped working
Your question is too vague, unless you specify which parts are and are not working you're unlikely to get much of an answer.

Is the problem on one computer or both? If only one then either events are set to false or security is preventing the code from running?

If the problem is on both then a more detailed explanation will be needed, but before explaining more please read and try the following.

There are a number of things that you can not do in a shared workbook, this is not limited to vba, but manual process as well. The link below tells you the things that you can not do in a shared workbook. Scroll to the bottom of the page then open the dropdown for 'Unsupported Features'

If there is something in your code that you can not find in that list, then try to carry out the task without using vba? If you are not able to complete the task then it is unsupported in shared workbooks, if you are able to do it then we would need to know what that task is and what is happening when you try to run the code, if nothing happens, or the wrong thing happens?

If the code crashes, then which line is causing the problem?
 
Upvote 0

Forum statistics

Threads
1,214,981
Messages
6,122,566
Members
449,089
Latest member
Motoracer88

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