Macros Error

KenTClark

New Member
Joined
Aug 16, 2022
Messages
10
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Hello,

Does anyone know how to fix this error pop-up window that says:

"Cannot run the macro "https ://d.docs.live.net/. etc./filelocation/filename'macrosname'. The macro may not be available in this workbook or all macros may be disabled "

Even with macros settings enabled fully, in excel 365 , the macros only runs once and then stops. It is supposed to keep printing row by row every 30 seconds but only does this once then the error pops up.
The macros is embedded in the same worksheet and references cells from the same worksheet. here is the code.

VBA Code:
Sub SavePrice()
    Dim WS As Worksheet, NextRow As Long
    
    Set WS = ThisWorkbook.Worksheets(1)
    WS.Cells(1, 1).RefreshLinkedDataType
    DoEvents
    WS.Cells(2, 1).Value = Now
    NextRow = WS.Cells(Rows.Count, 1).End(xlUp).Row + 1
    WS.Cells(NextRow, 1).Resize(1, 4).Value = Array(WS.Cells(2, 1).Value, WS.Cells(2, 2).Value, WS.Cells(2, 3).Value, WS.Cells(2, 4).Value)
    WS.Cells(NextRow, 5) = Cells(NextRow, 3) - Cells(NextRow, 4)
    If WS.Cells(1, 9).Value = True Then
        Exit Sub
    Else

Kind Regards, 
KC
    Application.OnTime Now + TimeValue("00:00:30"), "SavePrice"
    End If
    
End Sub
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hello,

Does anyone know how to fix this error pop-up window that says:

"Cannot run the macro "https ://d.docs.live.net/. etc./filelocation/filename'macrosname'. The macro may not be available in this workbook or all macros may be disabled "

Even with macros settings enabled fully, in excel 365 , the macros only runs once and then stops. It is supposed to keep printing row by row every 30 seconds but only does this once then the error pops up.
The macros is embedded in the same worksheet and references cells from the same worksheet. here is the code.

VBA Code:
Sub SavePrice()
    Dim WS As Worksheet, NextRow As Long
   
    Set WS = ThisWorkbook.Worksheets(1)
    WS.Cells(1, 1).RefreshLinkedDataType
    DoEvents
    WS.Cells(2, 1).Value = Now
    NextRow = WS.Cells(Rows.Count, 1).End(xlUp).Row + 1
    WS.Cells(NextRow, 1).Resize(1, 4).Value = Array(WS.Cells(2, 1).Value, WS.Cells(2, 2).Value, WS.Cells(2, 3).Value, WS.Cells(2, 4).Value)
    WS.Cells(NextRow, 5) = Cells(NextRow, 3) - Cells(NextRow, 4)
    If WS.Cells(1, 9).Value = True Then
        Exit Sub
    Else

Kind Regards,
KC
    Application.OnTime Now + TimeValue("00:00:30"), "SavePrice"
    End If
   
End Sub
Actually, the problem was where the code was entered. After inserting the code into a module, there was no pop-up error anymore . Lesson learned 😉
 
Upvote 0
Solution

Forum statistics

Threads
1,215,006
Messages
6,122,666
Members
449,091
Latest member
peppernaut

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