Run-Time error '28' out of stack space, Run-Time error '2147417848 (80010108)': Method 'Value' of object 'Range' Failed










1















I'm get the subject errors.
This code worked fine in Excel 2010, however I now have Excel 2013.The code is as follows can some body please help me I'm stumped. Code is as follows.



Private Sub Worksheet_Change(ByVal Target As Range)

Dim rng As Range, r As Range, rv As Long

If Not Intersect(Target, Range("C77:AD81")) Is Nothing Then
Set rng = Intersect(Target, Range("C77:AD81"))
For Each r In rng

'Peak Flow Doctor Warning

Select Case r.Value
Case 180
MsgBox "''PEAK FLOW CRITICAL AT 180L/MIN''" & vbCrLf & "''PREDNISONE PROBABLY REQUIRED''" & vbCrLf & "''MAKE DOCTOR'S APPOINTMENTS ASAP''", vbInformation, "WARNING"
Case 120
MsgBox "''PEAK FLOW CRITICAL AT 120L/MIN''" & vbCrLf & "''MAKE URGENT DOCTOR'S APPOINTMENTS''" & vbCrLf & "''OR GO TO A&E IMMEDIATELY''", vbInformation, "CRITICAL WARNING"
Case Is >= 525
MsgBox "''CHECK OR TEST PEAK FLOW METER''" & vbCrLf & "''IT MAY BE FAULTY AND GIVING FALSE HIGH's''", vbInformation, "WARNING"
End Select
Next r
End If
'OraKinetics needs to change to (Target, Range("C95:AD95"))
If Not Intersect(Target, Range("C93:AD93")) Is Nothing Then
Set rng = Intersect(Target, Range("C93:AD93"))
For Each r In rng

'Weight Gain Warning

Select Case r.Value
Case 90
MsgBox "''LIKELY TO EXACERBATE COPD SYMPTOMS''" & vbCrLf & "''CHRONIC ASTHMA OR EMPHYSEMA PROBABLE''", vbCritical, "WARNING"
Case 95
MsgBox "''IF SWELLING IN ANKLES PROBABLE FLUID RETENTION''" & vbCrLf & "''POSSIBILITY OF HEART FAILURE IF UNATTENDED''", vbCritical, "CRITICAL WARNING"
End Select
Next r
End If

'Change Best Peak Flow and Date Achieved

ActiveSheet.Unprotect Password:="asthma"
If Range("R7").Value > Range("F7").Value Then
Range("R7").Select
Selection.Copy
Range("F7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("K7") = Date
Application.CutCopyMode = False
ActiveSheet.Protect Password:="asthma", DrawingObjects:=True, Contents:=True, Scenarios:=True
End If
End Sub









share|improve this question



















  • 1





    Take a look at this link and this one. Most probably your VBA is modifying a cell which triggers the calculation of other cells, which then trigger the VBA again, forming a closed loop. This behave may fill your stack space. Try to identify this, or alternatively enclose parts of your VBA code with Application.EnableEvents = False / Application.EnableEvents = True until you find the issue in your sheet.

    – sɐunıɔןɐqɐp
    Nov 16 '18 at 7:43












  • Possible duplicate of Runtime error '28': Out of stack space in Excel VBA

    – sɐunıɔןɐqɐp
    Nov 16 '18 at 7:44











  • sɐunıɔןɐqɐp using your code enclosure suggestion I found the problem which is the "If Not Intersect(Target, Range("C77:AD81")) Is Nothing Then" code. but if I remove it the MsgBox's do not activate, and I'm not sure how to correct the b problem.

    – Father Goose
    Nov 16 '18 at 8:21















1















I'm get the subject errors.
This code worked fine in Excel 2010, however I now have Excel 2013.The code is as follows can some body please help me I'm stumped. Code is as follows.



Private Sub Worksheet_Change(ByVal Target As Range)

Dim rng As Range, r As Range, rv As Long

If Not Intersect(Target, Range("C77:AD81")) Is Nothing Then
Set rng = Intersect(Target, Range("C77:AD81"))
For Each r In rng

'Peak Flow Doctor Warning

Select Case r.Value
Case 180
MsgBox "''PEAK FLOW CRITICAL AT 180L/MIN''" & vbCrLf & "''PREDNISONE PROBABLY REQUIRED''" & vbCrLf & "''MAKE DOCTOR'S APPOINTMENTS ASAP''", vbInformation, "WARNING"
Case 120
MsgBox "''PEAK FLOW CRITICAL AT 120L/MIN''" & vbCrLf & "''MAKE URGENT DOCTOR'S APPOINTMENTS''" & vbCrLf & "''OR GO TO A&E IMMEDIATELY''", vbInformation, "CRITICAL WARNING"
Case Is >= 525
MsgBox "''CHECK OR TEST PEAK FLOW METER''" & vbCrLf & "''IT MAY BE FAULTY AND GIVING FALSE HIGH's''", vbInformation, "WARNING"
End Select
Next r
End If
'OraKinetics needs to change to (Target, Range("C95:AD95"))
If Not Intersect(Target, Range("C93:AD93")) Is Nothing Then
Set rng = Intersect(Target, Range("C93:AD93"))
For Each r In rng

'Weight Gain Warning

Select Case r.Value
Case 90
MsgBox "''LIKELY TO EXACERBATE COPD SYMPTOMS''" & vbCrLf & "''CHRONIC ASTHMA OR EMPHYSEMA PROBABLE''", vbCritical, "WARNING"
Case 95
MsgBox "''IF SWELLING IN ANKLES PROBABLE FLUID RETENTION''" & vbCrLf & "''POSSIBILITY OF HEART FAILURE IF UNATTENDED''", vbCritical, "CRITICAL WARNING"
End Select
Next r
End If

'Change Best Peak Flow and Date Achieved

ActiveSheet.Unprotect Password:="asthma"
If Range("R7").Value > Range("F7").Value Then
Range("R7").Select
Selection.Copy
Range("F7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("K7") = Date
Application.CutCopyMode = False
ActiveSheet.Protect Password:="asthma", DrawingObjects:=True, Contents:=True, Scenarios:=True
End If
End Sub









share|improve this question



















  • 1





    Take a look at this link and this one. Most probably your VBA is modifying a cell which triggers the calculation of other cells, which then trigger the VBA again, forming a closed loop. This behave may fill your stack space. Try to identify this, or alternatively enclose parts of your VBA code with Application.EnableEvents = False / Application.EnableEvents = True until you find the issue in your sheet.

    – sɐunıɔןɐqɐp
    Nov 16 '18 at 7:43












  • Possible duplicate of Runtime error '28': Out of stack space in Excel VBA

    – sɐunıɔןɐqɐp
    Nov 16 '18 at 7:44











  • sɐunıɔןɐqɐp using your code enclosure suggestion I found the problem which is the "If Not Intersect(Target, Range("C77:AD81")) Is Nothing Then" code. but if I remove it the MsgBox's do not activate, and I'm not sure how to correct the b problem.

    – Father Goose
    Nov 16 '18 at 8:21













1












1








1








I'm get the subject errors.
This code worked fine in Excel 2010, however I now have Excel 2013.The code is as follows can some body please help me I'm stumped. Code is as follows.



Private Sub Worksheet_Change(ByVal Target As Range)

Dim rng As Range, r As Range, rv As Long

If Not Intersect(Target, Range("C77:AD81")) Is Nothing Then
Set rng = Intersect(Target, Range("C77:AD81"))
For Each r In rng

'Peak Flow Doctor Warning

Select Case r.Value
Case 180
MsgBox "''PEAK FLOW CRITICAL AT 180L/MIN''" & vbCrLf & "''PREDNISONE PROBABLY REQUIRED''" & vbCrLf & "''MAKE DOCTOR'S APPOINTMENTS ASAP''", vbInformation, "WARNING"
Case 120
MsgBox "''PEAK FLOW CRITICAL AT 120L/MIN''" & vbCrLf & "''MAKE URGENT DOCTOR'S APPOINTMENTS''" & vbCrLf & "''OR GO TO A&E IMMEDIATELY''", vbInformation, "CRITICAL WARNING"
Case Is >= 525
MsgBox "''CHECK OR TEST PEAK FLOW METER''" & vbCrLf & "''IT MAY BE FAULTY AND GIVING FALSE HIGH's''", vbInformation, "WARNING"
End Select
Next r
End If
'OraKinetics needs to change to (Target, Range("C95:AD95"))
If Not Intersect(Target, Range("C93:AD93")) Is Nothing Then
Set rng = Intersect(Target, Range("C93:AD93"))
For Each r In rng

'Weight Gain Warning

Select Case r.Value
Case 90
MsgBox "''LIKELY TO EXACERBATE COPD SYMPTOMS''" & vbCrLf & "''CHRONIC ASTHMA OR EMPHYSEMA PROBABLE''", vbCritical, "WARNING"
Case 95
MsgBox "''IF SWELLING IN ANKLES PROBABLE FLUID RETENTION''" & vbCrLf & "''POSSIBILITY OF HEART FAILURE IF UNATTENDED''", vbCritical, "CRITICAL WARNING"
End Select
Next r
End If

'Change Best Peak Flow and Date Achieved

ActiveSheet.Unprotect Password:="asthma"
If Range("R7").Value > Range("F7").Value Then
Range("R7").Select
Selection.Copy
Range("F7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("K7") = Date
Application.CutCopyMode = False
ActiveSheet.Protect Password:="asthma", DrawingObjects:=True, Contents:=True, Scenarios:=True
End If
End Sub









share|improve this question
















I'm get the subject errors.
This code worked fine in Excel 2010, however I now have Excel 2013.The code is as follows can some body please help me I'm stumped. Code is as follows.



Private Sub Worksheet_Change(ByVal Target As Range)

Dim rng As Range, r As Range, rv As Long

If Not Intersect(Target, Range("C77:AD81")) Is Nothing Then
Set rng = Intersect(Target, Range("C77:AD81"))
For Each r In rng

'Peak Flow Doctor Warning

Select Case r.Value
Case 180
MsgBox "''PEAK FLOW CRITICAL AT 180L/MIN''" & vbCrLf & "''PREDNISONE PROBABLY REQUIRED''" & vbCrLf & "''MAKE DOCTOR'S APPOINTMENTS ASAP''", vbInformation, "WARNING"
Case 120
MsgBox "''PEAK FLOW CRITICAL AT 120L/MIN''" & vbCrLf & "''MAKE URGENT DOCTOR'S APPOINTMENTS''" & vbCrLf & "''OR GO TO A&E IMMEDIATELY''", vbInformation, "CRITICAL WARNING"
Case Is >= 525
MsgBox "''CHECK OR TEST PEAK FLOW METER''" & vbCrLf & "''IT MAY BE FAULTY AND GIVING FALSE HIGH's''", vbInformation, "WARNING"
End Select
Next r
End If
'OraKinetics needs to change to (Target, Range("C95:AD95"))
If Not Intersect(Target, Range("C93:AD93")) Is Nothing Then
Set rng = Intersect(Target, Range("C93:AD93"))
For Each r In rng

'Weight Gain Warning

Select Case r.Value
Case 90
MsgBox "''LIKELY TO EXACERBATE COPD SYMPTOMS''" & vbCrLf & "''CHRONIC ASTHMA OR EMPHYSEMA PROBABLE''", vbCritical, "WARNING"
Case 95
MsgBox "''IF SWELLING IN ANKLES PROBABLE FLUID RETENTION''" & vbCrLf & "''POSSIBILITY OF HEART FAILURE IF UNATTENDED''", vbCritical, "CRITICAL WARNING"
End Select
Next r
End If

'Change Best Peak Flow and Date Achieved

ActiveSheet.Unprotect Password:="asthma"
If Range("R7").Value > Range("F7").Value Then
Range("R7").Select
Selection.Copy
Range("F7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("K7") = Date
Application.CutCopyMode = False
ActiveSheet.Protect Password:="asthma", DrawingObjects:=True, Contents:=True, Scenarios:=True
End If
End Sub






excel vba excel-vba






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 8:49









FunThomas

5,4111626




5,4111626










asked Nov 16 '18 at 7:26









Father GooseFather Goose

375




375







  • 1





    Take a look at this link and this one. Most probably your VBA is modifying a cell which triggers the calculation of other cells, which then trigger the VBA again, forming a closed loop. This behave may fill your stack space. Try to identify this, or alternatively enclose parts of your VBA code with Application.EnableEvents = False / Application.EnableEvents = True until you find the issue in your sheet.

    – sɐunıɔןɐqɐp
    Nov 16 '18 at 7:43












  • Possible duplicate of Runtime error '28': Out of stack space in Excel VBA

    – sɐunıɔןɐqɐp
    Nov 16 '18 at 7:44











  • sɐunıɔןɐqɐp using your code enclosure suggestion I found the problem which is the "If Not Intersect(Target, Range("C77:AD81")) Is Nothing Then" code. but if I remove it the MsgBox's do not activate, and I'm not sure how to correct the b problem.

    – Father Goose
    Nov 16 '18 at 8:21












  • 1





    Take a look at this link and this one. Most probably your VBA is modifying a cell which triggers the calculation of other cells, which then trigger the VBA again, forming a closed loop. This behave may fill your stack space. Try to identify this, or alternatively enclose parts of your VBA code with Application.EnableEvents = False / Application.EnableEvents = True until you find the issue in your sheet.

    – sɐunıɔןɐqɐp
    Nov 16 '18 at 7:43












  • Possible duplicate of Runtime error '28': Out of stack space in Excel VBA

    – sɐunıɔןɐqɐp
    Nov 16 '18 at 7:44











  • sɐunıɔןɐqɐp using your code enclosure suggestion I found the problem which is the "If Not Intersect(Target, Range("C77:AD81")) Is Nothing Then" code. but if I remove it the MsgBox's do not activate, and I'm not sure how to correct the b problem.

    – Father Goose
    Nov 16 '18 at 8:21







1




1





Take a look at this link and this one. Most probably your VBA is modifying a cell which triggers the calculation of other cells, which then trigger the VBA again, forming a closed loop. This behave may fill your stack space. Try to identify this, or alternatively enclose parts of your VBA code with Application.EnableEvents = False / Application.EnableEvents = True until you find the issue in your sheet.

– sɐunıɔןɐqɐp
Nov 16 '18 at 7:43






Take a look at this link and this one. Most probably your VBA is modifying a cell which triggers the calculation of other cells, which then trigger the VBA again, forming a closed loop. This behave may fill your stack space. Try to identify this, or alternatively enclose parts of your VBA code with Application.EnableEvents = False / Application.EnableEvents = True until you find the issue in your sheet.

– sɐunıɔןɐqɐp
Nov 16 '18 at 7:43














Possible duplicate of Runtime error '28': Out of stack space in Excel VBA

– sɐunıɔןɐqɐp
Nov 16 '18 at 7:44





Possible duplicate of Runtime error '28': Out of stack space in Excel VBA

– sɐunıɔןɐqɐp
Nov 16 '18 at 7:44













sɐunıɔןɐqɐp using your code enclosure suggestion I found the problem which is the "If Not Intersect(Target, Range("C77:AD81")) Is Nothing Then" code. but if I remove it the MsgBox's do not activate, and I'm not sure how to correct the b problem.

– Father Goose
Nov 16 '18 at 8:21





sɐunıɔןɐqɐp using your code enclosure suggestion I found the problem which is the "If Not Intersect(Target, Range("C77:AD81")) Is Nothing Then" code. but if I remove it the MsgBox's do not activate, and I'm not sure how to correct the b problem.

– Father Goose
Nov 16 '18 at 8:21












1 Answer
1






active

oldest

votes


















0














If you're creating changes inside a _Change event then you need to disable events before the change to prevent an infinite loop.



Application.EnableEvents = False

ActiveSheet.Unprotect Password:="asthma"
If Range("R7").Value > Range("F7").Value Then
Range("R7").Select
Selection.Copy
Range("F7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("K7") = Date
Application.CutCopyMode = False
ActiveSheet.Protect Password:="asthma", DrawingObjects:=True, Contents:=True, Scenarios:=True
End If

Application.EnableEvents = True





share|improve this answer























  • Your so right thank you.

    – Father Goose
    Nov 16 '18 at 21:04











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53333232%2frun-time-error-28-out-of-stack-space-run-time-error-2147417848-80010108%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














If you're creating changes inside a _Change event then you need to disable events before the change to prevent an infinite loop.



Application.EnableEvents = False

ActiveSheet.Unprotect Password:="asthma"
If Range("R7").Value > Range("F7").Value Then
Range("R7").Select
Selection.Copy
Range("F7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("K7") = Date
Application.CutCopyMode = False
ActiveSheet.Protect Password:="asthma", DrawingObjects:=True, Contents:=True, Scenarios:=True
End If

Application.EnableEvents = True





share|improve this answer























  • Your so right thank you.

    – Father Goose
    Nov 16 '18 at 21:04















0














If you're creating changes inside a _Change event then you need to disable events before the change to prevent an infinite loop.



Application.EnableEvents = False

ActiveSheet.Unprotect Password:="asthma"
If Range("R7").Value > Range("F7").Value Then
Range("R7").Select
Selection.Copy
Range("F7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("K7") = Date
Application.CutCopyMode = False
ActiveSheet.Protect Password:="asthma", DrawingObjects:=True, Contents:=True, Scenarios:=True
End If

Application.EnableEvents = True





share|improve this answer























  • Your so right thank you.

    – Father Goose
    Nov 16 '18 at 21:04













0












0








0







If you're creating changes inside a _Change event then you need to disable events before the change to prevent an infinite loop.



Application.EnableEvents = False

ActiveSheet.Unprotect Password:="asthma"
If Range("R7").Value > Range("F7").Value Then
Range("R7").Select
Selection.Copy
Range("F7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("K7") = Date
Application.CutCopyMode = False
ActiveSheet.Protect Password:="asthma", DrawingObjects:=True, Contents:=True, Scenarios:=True
End If

Application.EnableEvents = True





share|improve this answer













If you're creating changes inside a _Change event then you need to disable events before the change to prevent an infinite loop.



Application.EnableEvents = False

ActiveSheet.Unprotect Password:="asthma"
If Range("R7").Value > Range("F7").Value Then
Range("R7").Select
Selection.Copy
Range("F7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("K7") = Date
Application.CutCopyMode = False
ActiveSheet.Protect Password:="asthma", DrawingObjects:=True, Contents:=True, Scenarios:=True
End If

Application.EnableEvents = True






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 16 '18 at 11:02









SamSam

15.7k33055




15.7k33055












  • Your so right thank you.

    – Father Goose
    Nov 16 '18 at 21:04

















  • Your so right thank you.

    – Father Goose
    Nov 16 '18 at 21:04
















Your so right thank you.

– Father Goose
Nov 16 '18 at 21:04





Your so right thank you.

– Father Goose
Nov 16 '18 at 21:04



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53333232%2frun-time-error-28-out-of-stack-space-run-time-error-2147417848-80010108%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

政党

天津地下鉄3号線