1
votes

According to Microsoft Developer Network, both Range.Delete and Worksheet.Delete method will return a value. However, by using the MsgBox function I can only view the return value for the Worksheet.Delete method but have no luck with the Range.Delete method. The code I used is MsgBox Worksheets("Sheet1").Delete

Here are the two articles from MSDN for your information: https://msdn.microsoft.com/en-us/library/office/ff837404.aspx https://msdn.microsoft.com/en-us/library/office/ff834641.aspx

1
If you need help with code, you need to post the code that is not working. Do this by editing your question. Please read the HELP topics for How do I Ask a Good Question, and also How to create a Minimal, Complete, and Verifiable example - Ron Rosenfeld
Your Worksheets example returns True for me, as does MsgBox ActiveSheet.Range("a2").Delete. - Doug Glancy
I used MsgBox Range("A1").Delete and an error is return. I tried MsgBox ActiveSheet.Range("a2").Delete and it works. But then I have another question. Why is ActiveSheet necessary in this scenario? Range("A2") = 16 is fine without following ActiveSheet. - patrick07124
Can you paste your code and the values of the ranges in question? - ib11

1 Answers

0
votes

This is an example of the use Range method that does return the value:

MsgBox ActiveSheet.Range("A1").Delete

HTH