{"id":12124,"date":"2012-01-26T09:28:15","date_gmt":"2012-01-26T09:28:15","guid":{"rendered":"http:\/\/www.learnexcelmacro.com\/?p=1309"},"modified":"2012-01-26T09:28:15","modified_gmt":"2012-01-26T09:28:15","slug":"difference-between-sheets-and-worksheets-in-excel-macro","status":"publish","type":"post","link":"https:\/\/vmlogger.com\/excel\/2012\/01\/difference-between-sheets-and-worksheets-in-excel-macro\/","title":{"rendered":"Difference between Sheets and Worksheets in Excel Macro"},"content":{"rendered":"
Dear Reader,<\/p>\n
In this article, I am going to write a very small trick about Excel Macro. In Excel Macro, you might have come across the situation where you need to Traverse all the Sheets of any Workbook one by one. You might have seen the below two methods to do so. As part of this article we will discuss what exactly the difference is between both the below methods:<\/p>\n
\nSub TraverseWorkSheet()\n Dim ws As Worksheet\n For Each Worksheet In Worksheets\n MsgBox (Worksheet.Name)\n Next\nEnd Sub\n<\/code><\/pre>\n2. <\/h3>\n\nSub TraverseSheet()\n For Each Sheet In Sheets\n MsgBox (Sheet.Name)\n Next\nEnd Sub\n<\/code><\/pre>\nDifference:<\/h3>\n
If you are using the KeyWord Sheet in Sheets<\/strong> then it will traverse all the WorkSheets of that Workbook, including Charts, Macro Sheet, International Macro Sheets etc.<\/strong>. <\/p>\nSee Example 2, above<\/h3>\n
In other hand if you use Keyword WorkSheet in WorkSheets<\/strong> then it will traverse only the WorkSheets. It will ignore all the Other Sheets like Charts, Macro Sheet, International Macro Sheets etc.<\/strong> <\/p>\nSee Example 1, above<\/h3>\n<\/span>","protected":false},"excerpt":{"rendered":"Dear Reader, In this article, I am going to write a very small trick about Excel Macro. In Excel Macro, you might have come across the situation where you need to Traverse all the Sheets of any Workbook one by one. You might have seen the below two methods to do so. As part of […]<\/p>\n","protected":false},"author":45,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[1674],"tags":[],"class_list":["post-12124","post","type-post","status-publish","format-standard","hentry","category-excel-macro-basics"],"yoast_head":"\n
Difference between Sheets and Worksheets in Excel Macro - Let's excel in Excel<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n\n\n\n\n\n\t\n\t\n\t\n