{"id":406507,"date":"2024-06-29T18:59:08","date_gmt":"2024-06-29T18:59:08","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=406507"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=406507","title":{"rendered":"<span>ChatGPT \u043d\u0435 \u0443\u043c\u0435\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u043c\u0430\u043a\u0440\u043e\u0441\u044b<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/046\/2fc\/2c4\/0462fc2c46cfdc4d4f4685dbee2d930e.png\" width=\"1280\" height=\"662\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/046\/2fc\/2c4\/0462fc2c46cfdc4d4f4685dbee2d930e.png\"\/><\/figure>\n<p><em>\u0422\u044b \u043f\u043e\u043f\u0430\u043b\u0441\u044f \u043d\u0430 \u043a\u043b\u0438\u043a\u0431\u0435\u0439\u0442, \u043e\u043b\u0443\u0443&#8230;<\/em> \u043d\u0443 \u043d\u0435\u0442, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u0432\u0441\u0435 \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435 (\u0430 \u0435\u0441\u043b\u0438 \u043d\u0435 \u0437\u043d\u0430\u0435\u0442\u0435, \u0442\u043e \u043f\u043e\u0440\u0430 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0438\u0437 \u0432\u0430\u043a\u0443\u0443\u043c\u0430 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0435\u0441\u044c) \u043f\u0440\u043e \u0442\u0430\u043a\u0443\u044e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u043a\u0430\u043a ChatGPT. \u041c\u043d\u0435 \u0432\u0441\u0435 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0443\u0434\u0430\u0432\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u044e\u0437\u0430\u0442\u044c \u0432 \u0441\u0432\u044f\u0437\u0438 \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0438 \u0432\u043e\u0442 \u0432\u0447\u0435\u0440\u0430 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u043f\u043e\u0432\u0435\u0437\u043b\u043e. \u041d\u0443 \u0438 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u044f \u043d\u0430\u0447\u0430\u043b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0435\u0433\u043e \u0437\u043d\u0430\u043d\u0438\u044f VBA?<\/p>\n<p>\u0418 \u043a\u0430\u043a \u043d\u0438 \u0441\u0442\u0440\u0430\u043d\u043d\u043e \u043e\u043d\u0438 \u043d\u0435\u043f\u043b\u043e\u0445\u0438\u0435, \u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u0431\u0435\u0437 \u043f\u0440\u0430\u0432\u043e\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0435\u0439\u0440\u043e\u043d\u043a\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0443\u0434\u0430\u0432\u0430\u043b\u043e\u0441\u044c \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430.<br \/>\u0422\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043d\u0435 \u043e\u0431\u044a\u044f\u0432\u0438\u0442:<\/p>\n<pre><code class=\"vbscript\">Function GetRightBoundary(rng As Range) As Long     Dim cols As Collection     Set cols = New Collection      For Each col In rng.Columns ' \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u043d \u0437\u043d\u0430\u0435\u0442 \u043f\u0440\u043e Option Explicit.         If WorksheetFunction.CountA(col) > 0 Then cols.Add col.Column     Next col     GetRightBoundary = WorksheetFunction.Max(cols) End Function<\/code><\/pre>\n<p>\u0422\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u043c\u0435\u0442\u043e\u0434 <code>Max<\/code> \u0438\u0437 <code>WoksheetFunction<\/code> \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435 \u043e\u043d \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 <code>Collection<\/code>).<\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0447\u0430\u0441\u043e\u0432 <em>\u0438\u0433\u0440<\/em>, \u044f \u0442\u0430\u043a\u0438 \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0438 \u0434\u043e\u0432\u0435\u0441\u0442\u0438 \u0435\u0435 \u0434\u043e \u043a\u043e\u043d\u0446\u0430. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043b\u043e\u0436\u0438\u043b \u043d\u0430 <a href=\"https:\/\/github.com\/artodoro\/TableFinder\" rel=\"noopener noreferrer nofollow\">GitHub<\/a>. \u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0443-\u0442\u043e \u043b\u0435\u043d\u044c \u0447\u0438\u0442\u0430\u0442\u044c \u043c\u043e\u044e \u0433\u0435\u043d\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u043e\u0434 \u0442\u0430\u043c.<\/p>\n<p>\u041c\u043d\u0435 \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438, \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d (\u0447\u0430\u0441\u0442\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u043c\u0435\u0449\u0435\u043d\u0430 \u043f\u043e \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u0438, \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u0430\u044f \u0448\u0430\u043f\u043a\u0430 \u043d\u0430\u0434 \u043d\u0435\u0439).<\/p>\n<p>\u042f \u0440\u0435\u0448\u0438\u043b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e ChatGPT \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0435\u043a\u0438\u0439 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d (\u0430 \u0442\u043e\u0447\u043d\u0435\u0435 UsedRange), \u0430 \u043e\u043d \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0432 \u044d\u0442\u043e\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438 \u0435\u0441\u043b\u0438 \u043d\u0430\u0439\u0434\u0435\u0442, \u0442\u043e \u0432\u0435\u0440\u043d\u0435\u0442 \u0443\u0436\u0435 \u0435\u0435 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b:<\/p>\n<blockquote>\n<p><em>\u0412 excel \u043d\u0430 \u043b\u0438\u0441\u0442\u0435 \u0435\u0441\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0430. \u041d\u0430\u0447\u0430\u043b\u043e \u0438 \u043a\u043e\u043d\u0435\u0446 \u0435\u0435 \u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b. \u0418\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0447\u0442\u043e \u043d\u0430\u0434 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043b\u0438\u0448\u043d\u0438\u0435 \u044f\u0447\u0435\u0439\u043a\u0438 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u0435\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c. \u041d\u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c vba \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043b\u0438\u0441\u0442, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0441\u043a\u043e\u043c\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u044d\u0442\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b (\u0431\u0435\u0437 \u043b\u0438\u0448\u043d\u0435\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f).<\/em>  <\/p>\n<p><code>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b Find \u0438\u043b\u0438 FindNext, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u043f\u0435\u0440\u0432\u0443\u044e \u044f\u0447\u0435\u0439\u043a\u0443 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u044f\u0447\u0435\u0439\u043a\u0443 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435. \u0417\u0430\u0442\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 Intersect, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u0415\u0441\u043b\u0438 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d, \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d \u0432\u0435\u0441\u044c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d.<\/code><\/p>\n<p><code>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0435\u0448\u0430\u0435\u0442 \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443:<\/code><\/p>\n<\/blockquote>\n<pre><code class=\"vbscript\">Function FindTableRange(sheet As Worksheet) As Range     Dim firstCell As Range     Dim lastCell As Range     Dim tableRange As Range          ' \u0418\u0449\u0435\u043c \u043f\u0435\u0440\u0432\u0443\u044e \u044f\u0447\u0435\u0439\u043a\u0443 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435     Set firstCell = sheet.Cells.Find(What:=\"*\", _                                       After:=sheet.Cells(1, 1), _                                       LookAt:=xlPart, _                                       SearchOrder:=xlByRows, _                                       SearchDirection:=xlNext, _                                       MatchCase:=False)                                            If Not firstCell Is Nothing Then         ' \u0418\u0449\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u044f\u0447\u0435\u0439\u043a\u0443 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435         Set lastCell = sheet.Cells.Find(What:=\"*\", _                                          After:=sheet.Cells(1, 1), _                                          LookAt:=xlPart, _                                          SearchOrder:=xlByRows, _                                          SearchDirection:=xlPrevious, _                                          MatchCase:=False)                                                   ' \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434 Intersect, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0435\u0437 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430         If Not Intersect(firstCell.EntireRow, sheet.UsedRange) Is Nothing And _            Not Intersect(lastCell.EntireRow, sheet.UsedRange) Is Nothing Then             Set tableRange = sheet.Range(firstCell, lastCell).Offset(1).Resize(lastCell.row - firstCell.row)         Else             Set tableRange = sheet.UsedRange         End If     Else         Set tableRange = sheet.UsedRange     End If          Set FindTableRange = tableRange End Function<\/code><\/pre>\n<p>\u041d\u0435\u043f\u043b\u043e\u0445\u043e, \u043d\u043e \u044d\u0442\u043e\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0443\u0436\u043d\u043e.<\/p>\n<p>\u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u043e\u043d \u0432\u0435\u0440\u043d\u0435\u0442 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d <code>A3:S28<\/code>, \u043a\u043e\u0433\u0434\u0430 \u0441\u0430\u043c\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 <code>C9:S28<\/code>:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4a6\/482\/c9a\/4a6482c9a59d4cf754c0bda394c95c1b.png\" width=\"1282\" height=\"628\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4a6\/482\/c9a\/4a6482c9a59d4cf754c0bda394c95c1b.png\"\/><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0431\u0435\u0437\u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0445 \u043f\u043e\u043f\u044b\u0442\u043e\u043a, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u043c\u043e\u0447\u044c \u043d\u0435\u0439\u0440\u043e\u043d\u043a\u0435, \u0438 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c:<\/p>\n<blockquote>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0439\u0442\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<br \/>\u0414\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f <strong>\u0432\u0435\u0440\u0445\u043d\u0435\u0439<\/strong> \u0433\u0440\u0430\u043d\u0438\u0446\u044b, \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430, \u043d\u0430\u0439\u0442\u0438 \u0432 \u043d\u0438\u0445 \u043d\u043e\u043c\u0435\u0440\u0430 <em>\u043f\u0435\u0440\u0432\u044b\u0445<\/em> \u043d\u0435\u043f\u0443\u0441\u0442\u044b\u0445 \u0441\u0442\u0440\u043e\u043a \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0438\u0445 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432. \u041c\u0435\u0434\u0438\u0430\u043d\u0430 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u044d\u0442\u0438\u0445 \u0441\u0442\u0440\u043e\u043a \u2013 \u0432\u0435\u0440\u0445\u043d\u044f\u044f \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<br \/>\u0414\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f <strong>\u043d\u0438\u0436\u043d\u0435\u0439<\/strong> \u0433\u0440\u0430\u043d\u0438\u0446\u044b, \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430, \u043d\u0430\u0439\u0442\u0438 \u0432 \u043d\u0438\u0445 \u043d\u043e\u043c\u0435\u0440\u0430 <em>\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445<\/em> \u043d\u0435\u043f\u0443\u0441\u0442\u044b\u0445 \u0441\u0442\u0440\u043e\u043a \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0438\u0445 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432. \u041c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0438\u0437 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u044d\u0442\u0438\u0445 \u0441\u0442\u0440\u043e\u043a \u2013 \u043d\u0438\u0436\u043d\u044f\u044f \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<br \/>\u0414\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f <strong>\u043b\u0435\u0432\u043e\u0439 <\/strong>\u0433\u0440\u0430\u043d\u0438\u0446\u044b, \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430, \u043d\u0430\u0439\u0442\u0438 \u0432 \u043d\u0438\u0445 \u043d\u043e\u043c\u0435\u0440\u0430 <em>\u043f\u0435\u0440\u0432\u044b\u0445<\/em> \u043d\u0435\u043f\u0443\u0441\u0442\u044b\u0445 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0438\u0445 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432. \u041c\u0435\u0434\u0438\u0430\u043d\u0430 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u044d\u0442\u0438\u0445 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u2013 \u043b\u0435\u0432\u0430\u044f \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<br \/>\u0414\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f <strong>\u043f\u0440\u0430\u0432\u043e\u0439 <\/strong>\u0433\u0440\u0430\u043d\u0438\u0446\u044b, \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430, \u043d\u0430\u0439\u0442\u0438 \u0432 \u043d\u0438\u0445 \u043d\u043e\u043c\u0435\u0440\u0430 <em>\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 <\/em>\u043d\u0435\u043f\u0443\u0441\u0442\u044b\u0445 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0438\u0445 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432. \u041c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0438\u0437 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u044d\u0442\u0438\u0445 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u2013 \u043f\u0440\u0430\u0432\u0430\u044f \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<p><code>\u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 VBA \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/code>  <\/p>\n<\/blockquote>\n<pre><code class=\"vbscript\">Function FindTableRange(tableRange As Range) As Range      Dim numRows As Long     Dim numCols As Long     Dim row As Long     Dim col As Long     Dim topRow As Long     Dim bottomRow As Long     Dim leftCol As Long     Dim rightCol As Long     Dim topRows() As Long     Dim bottomRows() As Long     Dim leftCols() As Long     Dim rightCols() As Long          numRows = tableRange.rows.Count     numCols = tableRange.Columns.Count          ReDim topRows(1 To numCols)     ReDim bottomRows(1 To numCols)     ReDim leftCols(1 To numRows)     ReDim rightCols(1 To numRows)          For col = 1 To numCols         topRows(col) = tableRange.rows.Count         bottomRows(col) = 1         For row = 1 To numRows             If Not IsEmpty(tableRange(row, col)) Then                 If row &lt; topRows(col) Then topRows(col) = row                 If row > bottomRows(col) Then bottomRows(col) = row                 If leftCols(row) = 0 Then leftCols(row) = col                 rightCols(row) = col             End If         Next row     Next col          topRow = WorksheetFunction.Median(topRows)     bottomRow = WorksheetFunction.Max(bottomRows)     leftCol = WorksheetFunction.Median(leftCols)     rightCol = WorksheetFunction.Max(rightCols)          Set FindTableRange = Intersect(tableRange.Worksheet.Range(tableRange.Cells(topRow, leftCol), tableRange.Cells(bottomRow, rightCol)), tableRange.Worksheet.UsedRange)      End Function<\/code><\/pre>\n<p>\u0411\u0438\u043d\u0433\u043e! \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0434\u0430\u0435\u0442 \u0432\u0435\u0440\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u041d\u043e \u043c\u043d\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u0430\u043b\u043e. \u042f \u0445\u043e\u0447\u0443 \u043a\u043b\u0430\u0441\u0441, \u0438 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433, \u0438 \u0447\u0442\u043e\u0431 \u043f\u043e \u043a\u0440\u0430\u0441\u043e\u0442\u0435.<\/p>\n<p>\u041d\u0435 \u0431\u0435\u0437 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u043e\u043a, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u043e \u0441\u043f\u0443\u0441\u0442\u044f \u043c\u0438\u043d\u0443\u0442 30-40 (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435\/\u0431\u043e\u043b\u044c\u0448\u0435, \u043d\u0435 \u043f\u043e\u043c\u043d\u044e), \u044f \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<br \/>\u0414\u0430\u043b\u0435\u0435 \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Rubberduck:<\/p>\n<blockquote>\n<p><code>\u0425\u043e\u0440\u043e\u0448\u043e, \u044f \u043c\u043e\u0433\u0443 \u043f\u043e\u043c\u043e\u0447\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c unit-\u0442\u0435\u0441\u0442\u044b \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Rubberduck.<\/code><\/p>\n<p><code>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043d\u0430\u0447\u0430\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e Rubberduck \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u0432 Visual Studio.<\/code><\/p>\n<p><code>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0442\u0435\u0441\u0442\u043e\u0432. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 FindTableRange:<\/code><\/p>\n<\/blockquote>\n<pre><code class=\"vbscript\">Option Explicit '@TestModule '@Folder \"Tests\" Private Assert As Object @ModuleInitializee Public Sub ModuleInitialize() Set Assert = CreateObject(\"Rubberduck.AssertClass\") End Sub @ModuleCleanupp Public Sub ModuleCleanup() Set Assert = Nothing End Sub @TestMethodd Public Sub Test_FindTableRange_SimpleTable() 'Arrange Dim rng As Range Set rng = ThisWorkbook.Sheets(\"Sheet1\").Range(\"A1:C3\") 'Act Dim result As Range Set result = FindTableRange(rng)  'Assert Assert.AreEqual \"A2:C3\", result.Address  End Sub @TestMethodd Public Sub Test_FindTableRange_EmptyTable() 'Arrange Dim rng As Range Set rng = ThisWorkbook.Sheets(\"Sheet1\").Range(\"A1:C1\") 'Act Dim result As Range Set result = FindTableRange(rng)  'Assert Assert.IsNull result  End Sub @TestMethodd Public Sub Test_FindTableRange_TableWithEmptyRowsAndColumns() 'Arrange Dim rng As Range Set rng = ThisWorkbook.Sheets(\"Sheet1\").Range(\"A1:D5\") rng.Cells(2, 2).ClearContents rng.Cells(4, 3).ClearContents 'Act Dim result As Range Set result = FindTableRange(rng)  'Assert Assert.AreEqual \"B3:C4\", result.Address  End Sub @TestMethodd Public Sub Test_FindTableRange_TableWithHeader() 'Arrange Dim rng As Range Set rng = ThisWorkbook.Sheets(\"Sheet1\").Range(\"A1:C4\") rng.Cells(1, 1).Value = \"Header1\" rng.Cells(1, 2).Value = \"Header2\" rng.Cells(1, 3).Value = \"Header3\" 'Act Dim result As Range Set result = FindTableRange(rng)  'Assert Assert.AreEqual \"A2:C4\", result.Address  End Sub @TestMethodd Public Sub Test_FindTableRange_TableWithMultipleRanges() 'Arrange Dim rng As Range Set rng = ThisWorkbook.Sheets(\"Sheet1\").Range(\"A1:C3\") Dim rng2 As Range Set rng2 = ThisWorkbook.Sheets(\"Sheet1\").Range(\"D1:F3\") Dim multiRange As Range Set multiRange = Union(rng, rng2) 'Act Dim result As Range Set result = FindTableRange(multiRange)  'Assert Assert.AreEqual \"A2:F3\", result.Address  End Sub <\/code><\/pre>\n<blockquote>\n<p><code>\u042d\u0442\u0438 \u0442\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 FindTableRange, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0443\u0441\u0442\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043f\u0443\u0441\u0442\u044b\u043c\u0438 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438 \u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u043c\u0438, \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430\u043c\u0438 \u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430\u043c\u0438.<\/code><\/p>\n<p><code>\u0422\u0435\u0441\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Rubberduck, \u0432\u044b\u0431\u0440\u0430\u0432 \u043a\u043b\u0430\u0441\u0441 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432 \u043e\u043a\u043d\u0435 \"Unit Test Explorer\" \u0438 \u043d\u0430\u0436\u0430\u0432 \u043a\u043d\u043e\u043f\u043a\u0443 \"Run\".<\/code><\/p>\n<\/blockquote>\n<p>\u041d\u0435 \u0431\u0435\u0437 \u0432\u043e\u043f\u0440\u043e\u0441\u0438\u043a\u043e\u0432, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0432, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b.<br \/>\u041d\u0443 \u0438 \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a \u044f \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432 \u0441\u0442\u0438\u043b\u0435 VB.Net:<\/p>\n<blockquote>\n<p><code>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043a \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u043a\u043b\u0430\u0441\u0441\u0430:<\/code><\/p>\n<\/blockquote>\n<pre><code class=\"vbscript\">Option Explicit  ''' &lt;summary> ''' \u042d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0430 \u043b\u0438\u0441\u0442\u0435 Excel. ''' &lt;\/summary>  ''' &lt;summary> ''' \u041d\u0430\u0445\u043e\u0434\u0438\u0442 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 Range. ''' &lt;\/summary> ''' &lt;param name=\"rng\">\u0414\u0438\u0430\u043f\u0430\u0437\u043e\u043d Range, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0443.&lt;\/param> ''' &lt;returns>\u0414\u0438\u0430\u043f\u0430\u0437\u043e\u043d Range, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0443.&lt;\/returns> ''' &lt;example> ''' \u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f: ''' &lt;code> ''' Dim tableRange As Range ''' Set tableRange = FindTableRange(Range(\"A1:F10\")) ''' &lt;\/code> ''' &lt;\/example> Public Function FindTableRange(ByVal rng As Range) As Range     Dim top As Long, bottom As Long, left As Long, right As Long          If WorksheetFunction.CountA(rng) = 0 Then         Set FindTableRange = Nothing         Exit Function     End If          top = FindBoundary(rng, False, xlNext)     bottom = FindBoundary(rng, False, xlPrevious)     left = FindBoundary(rng, True, xlNext)     right = FindBoundary(rng, True, xlPrevious)          If top > 0 And bottom > 0 And left > 0 And right > 0 Then         Set FindTableRange = rng.Parent.Range(rng.Cells(top, left), rng.Cells(bottom, right))     End If End Function  ''' &lt;summary> ''' \u041d\u0430\u0445\u043e\u0434\u0438\u0442 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 Range \u043f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e. ''' &lt;\/summary> ''' &lt;param name=\"rng\">\u0414\u0438\u0430\u043f\u0430\u0437\u043e\u043d Range, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0442\u0430\u0431\u043b\u0438\u0446\u044b.&lt;\/param> ''' &lt;param name=\"isRow\">\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0438\u0449\u0443\u0442\u0441\u044f \u043b\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u0442\u0440\u043e\u043a.&lt;\/param> ''' &lt;param name=\"Direction\">\u041d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 \u0433\u0440\u0430\u043d\u0438\u0446 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.&lt;\/param> ''' &lt;returns>\u0427\u0438\u0441\u043b\u043e, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0435 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.&lt;\/returns> Private Function FindBoundary(ByVal rng As Range, ByVal isRow As Boolean, ByVal Direction As XlSearchDirection) As Long     Dim Arr() As Long     Arr = FindBoundaryArray(rng, isRow, Direction)          If UBound(Arr) > 0 Then         If isRow Then             FindBoundary = WorksheetFunction.Median(Arr)         Else             FindBoundary = WorksheetFunction.Max(Arr)         End If     Else         FindBoundary = 0     End If End Function  ''' &lt;summary> ''' \u041d\u0430\u0445\u043e\u0434\u0438\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0433\u0440\u0430\u043d\u0438\u0446 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 Range \u043f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e. ''' &lt;\/summary> ''' &lt;param name=\"rng\">\u0414\u0438\u0430\u043f\u0430\u0437\u043e\u043d Range, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0442\u0430\u0431\u043b\u0438\u0446\u044b.&lt;\/param> ''' &lt;param name=\"isRow\">\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0438\u0449\u0443\u0442\u0441\u044f \u043b\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u0442\u0440\u043e\u043a.&lt;\/param> ''' &lt;param name=\"Direction\">\u041d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 \u0433\u0440\u0430\u043d\u0438\u0446 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.&lt;\/param> ''' &lt;returns>\u041c\u0430\u0441\u0441\u0438\u0432 \u0447\u0438\u0441\u0435\u043b, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0442\u0430\u0431\u043b\u0438\u0446\u044b.&lt;\/returns> Private Function FindBoundaryArray(ByVal rng As Range, ByVal isRow As Boolean, ByVal Direction As XlSearchDirection) As Variant     Dim i As Long     Dim Arr() As Long          If WorksheetFunction.CountA(rng) = 0 Then         FindBoundaryArray = 0         Exit Function     End If          If isRow And Direction = xlNext Then         ReDim Arr(1 To rng.rows.Count)         For i = 1 To rng.rows.Count             Arr(i) = FindLeftBoundary(rng, i)         Next i     ElseIf isRow And Direction = xlPrevious Then         ReDim Arr(1 To rng.rows.Count)         For i = 1 To rng.rows.Count             Arr(i) = FindRightBoundary(rng, i)         Next i     ElseIf Not isRow And Direction = xlNext Then         ReDim Arr(1 To rng.Columns.Count)         For i = 1 To rng.Columns.Count             Arr(i) = FindTopBoundary(rng, i)         Next i     ElseIf Not isRow And Direction = xlPrevious Then         ReDim Arr(1 To rng.Columns.Count)         For i = 1 To rng.Columns.Count             Arr(i) = FindBottomBoundary(rng, i)         Next i     End If          FindBoundaryArray = Arr End Function  ''' &lt;summary> ''' \u041d\u0430\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0430\u0432\u0443\u044e \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 Range. ''' &lt;\/summary> ''' &lt;param name=\"rng\">\u0414\u0438\u0430\u043f\u0430\u0437\u043e\u043d Range, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.&lt;\/param> ''' &lt;param name=\"rowIdx\">\u0418\u043d\u0434\u0435\u043a\u0441 \u0441\u0442\u0440\u043e\u043a\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.&lt;\/param> ''' &lt;returns>\u0427\u0438\u0441\u043b\u043e, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0435 \u043f\u0440\u0430\u0432\u0443\u044e \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.&lt;\/returns> Private Function FindRightBoundary(ByVal rng As Range, ByVal rowIdx As Long) As Long     Dim colIdx As Long     For colIdx = rng.Columns.Count To 1 Step -1         If Not IsEmpty(rng(rowIdx, colIdx)) Then             FindRightBoundary = colIdx             Exit Function         End If     Next colIdx     FindRightBoundary = 0 End Function  ''' &lt;summary> ''' \u041d\u0430\u0445\u043e\u0434\u0438\u0442 \u043d\u0438\u0436\u043d\u044e\u044e \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u0435 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 Range. ''' &lt;\/summary> ''' &lt;param name=\"rng\">\u0414\u0438\u0430\u043f\u0430\u0437\u043e\u043d Range, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.&lt;\/param> ''' &lt;param name=\"colIdx\">\u0418\u043d\u0434\u0435\u043a\u0441 \u0441\u0442\u043e\u043b\u0431\u0446\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.&lt;\/param> ''' &lt;returns>\u0427\u0438\u0441\u043b\u043e, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0435 \u043d\u0438\u0436\u043d\u044e\u044e \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.&lt;\/returns> Private Function FindBottomBoundary(ByVal rng As Range, ByVal colIdx As Long) As Long     Dim rowIdx As Long     For rowIdx = rng.rows.Count To 1 Step -1         If Not IsEmpty(rng(rowIdx, colIdx)) Then             FindBottomBoundary = rowIdx             Exit Function         End If     Next rowIdx     FindBottomBoundary = 0 End Function  ''' &lt;summary> ''' \u041d\u0430\u0445\u043e\u0434\u0438\u0442 \u043b\u0435\u0432\u0443\u044e \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 Range. ''' &lt;\/summary> ''' &lt;param name=\"rng\">\u0414\u0438\u0430\u043f\u0430\u0437\u043e\u043d Range, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.&lt;\/param> ''' &lt;param name=\"rowIdx\">\u0418\u043d\u0434\u0435\u043a\u0441 \u0441\u0442\u0440\u043e\u043a\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.&lt;\/param> ''' &lt;returns>\u0427\u0438\u0441\u043b\u043e, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0435 \u043b\u0435\u0432\u0443\u044e \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.&lt;\/returns> Private Function FindLeftBoundary(ByVal rng As Range, ByVal rowIdx As Long) As Long     Dim colIdx As Long     For colIdx = 1 To rng.Columns.Count Step 1         If Not IsEmpty(rng(rowIdx, colIdx)) Then             FindLeftBoundary = colIdx             Exit Function         End If     Next colIdx     FindLeftBoundary = 0 End Function  ''' &lt;summary> ''' \u041d\u0430\u0445\u043e\u0434\u0438\u0442 \u0432\u0435\u0440\u0445\u043d\u044e\u044e \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u0435 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 Range. ''' &lt;\/summary> ''' &lt;param name=\"rng\">\u0414\u0438\u0430\u043f\u0430\u0437\u043e\u043d Range, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.&lt;\/param> ''' &lt;param name=\"colIdx\">\u0418\u043d\u0434\u0435\u043a\u0441 \u0441\u0442\u043e\u043b\u0431\u0446\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.&lt;\/param> ''' &lt;returns>\u0427\u0438\u0441\u043b\u043e, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0435 \u0432\u0435\u0440\u0445\u043d\u044e\u044e \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.&lt;\/returns> Private Function FindTopBoundary(ByVal rng As Range, ByVal colIdx As Long) As Long     Dim rowIdx As Long     For rowIdx = 1 To rng.rows.Count Step 1         If Not IsEmpty(rng(rowIdx, colIdx)) Then             FindTopBoundary = rowIdx             Exit Function         End If     Next rowIdx     FindTopBoundary = 0 End Function<\/code><\/pre>\n<p>\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043c\u044b \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u043b\u0438 \u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0430\u043c\u0438 \u0432 \u043c\u043e\u0435\u043c <a href=\"https:\/\/t.me\/+dT4t66NKN7wyNThi\" rel=\"noopener noreferrer nofollow\">\u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u043a\u0430\u043d\u0430\u043b\u0435 <\/a>(<sub>\u043d\u0435<\/sub> <strong>\u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c<\/strong>).<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/738038\/\"> https:\/\/habr.com\/ru\/articles\/738038\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><\/figure>\n<p><em>\u0422\u044b \u043f\u043e\u043f\u0430\u043b\u0441\u044f \u043d\u0430 \u043a\u043b\u0438\u043a\u0431\u0435\u0439\u0442, \u043e\u043b\u0443\u0443&#8230;<\/em> \u043d\u0443 \u043d\u0435\u0442, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u0432\u0441\u0435 \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435 (\u0430 \u0435\u0441\u043b\u0438 \u043d\u0435 \u0437\u043d\u0430\u0435\u0442\u0435, \u0442\u043e \u043f\u043e\u0440\u0430 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0438\u0437 \u0432\u0430\u043a\u0443\u0443\u043c\u0430 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0435\u0441\u044c) \u043f\u0440\u043e \u0442\u0430\u043a\u0443\u044e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u043a\u0430\u043a ChatGPT. \u041c\u043d\u0435 \u0432\u0441\u0435 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0443\u0434\u0430\u0432\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u044e\u0437\u0430\u0442\u044c \u0432 \u0441\u0432\u044f\u0437\u0438 \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0438 \u0432\u043e\u0442 \u0432\u0447\u0435\u0440\u0430 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u043f\u043e\u0432\u0435\u0437\u043b\u043e. \u041d\u0443 \u0438 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u044f \u043d\u0430\u0447\u0430\u043b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0435\u0433\u043e \u0437\u043d\u0430\u043d\u0438\u044f VBA?<\/p>\n<p>\u0418 \u043a\u0430\u043a \u043d\u0438 \u0441\u0442\u0440\u0430\u043d\u043d\u043e \u043e\u043d\u0438 \u043d\u0435\u043f\u043b\u043e\u0445\u0438\u0435, \u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u0431\u0435\u0437 \u043f\u0440\u0430\u0432\u043e\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0435\u0439\u0440\u043e\u043d\u043a\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0443\u0434\u0430\u0432\u0430\u043b\u043e\u0441\u044c \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430.<br \/>\u0422\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043d\u0435 \u043e\u0431\u044a\u044f\u0432\u0438\u0442:<\/p>\n<pre><code class=\"vbscript\">Function GetRightBoundary(rng As Range) As Long     Dim cols As Collection     Set cols = New Collection      For Each col In rng.Columns ' \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u043d \u0437\u043d\u0430\u0435\u0442 \u043f\u0440\u043e Option Explicit.         If WorksheetFunction.CountA(col) > 0 Then cols.Add col.Column     Next col     GetRightBoundary = WorksheetFunction.Max(cols) End Function<\/code><\/pre>\n<p>\u0422\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u043c\u0435\u0442\u043e\u0434 <code>Max<\/code> \u0438\u0437 <code>WoksheetFunction<\/code> \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435 \u043e\u043d \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 <code>Collection<\/code>).<\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0447\u0430\u0441\u043e\u0432 <em>\u0438\u0433\u0440<\/em>, \u044f \u0442\u0430\u043a\u0438 \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0438 \u0434\u043e\u0432\u0435\u0441\u0442\u0438 \u0435\u0435 \u0434\u043e \u043a\u043e\u043d\u0446\u0430. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043b\u043e\u0436\u0438\u043b \u043d\u0430 <a href=\"https:\/\/github.com\/artodoro\/TableFinder\" rel=\"noopener noreferrer nofollow\">GitHub<\/a>. \u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0443-\u0442\u043e \u043b\u0435\u043d\u044c \u0447\u0438\u0442\u0430\u0442\u044c \u043c\u043e\u044e \u0433\u0435\u043d\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u043e\u0434 \u0442\u0430\u043c.<\/p>\n<p>\u041c\u043d\u0435 \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438, \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d (\u0447\u0430\u0441\u0442\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u043c\u0435\u0449\u0435\u043d\u0430 \u043f\u043e \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u0438, \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u0430\u044f \u0448\u0430\u043f\u043a\u0430 \u043d\u0430\u0434 \u043d\u0435\u0439).<\/p>\n<p>\u042f \u0440\u0435\u0448\u0438\u043b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e ChatGPT \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0435\u043a\u0438\u0439 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d (\u0430 \u0442\u043e\u0447\u043d\u0435\u0435 UsedRange), \u0430 \u043e\u043d \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0432 \u044d\u0442\u043e\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438 \u0435\u0441\u043b\u0438 \u043d\u0430\u0439\u0434\u0435\u0442, \u0442\u043e \u0432\u0435\u0440\u043d\u0435\u0442 \u0443\u0436\u0435 \u0435\u0435 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b:<\/p>\n<blockquote>\n<p><em>\u0412 excel \u043d\u0430 \u043b\u0438\u0441\u0442\u0435 \u0435\u0441\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0430. \u041d\u0430\u0447\u0430\u043b\u043e \u0438 \u043a\u043e\u043d\u0435\u0446 \u0435\u0435 \u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b. \u0418\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0447\u0442\u043e \u043d\u0430\u0434 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043b\u0438\u0448\u043d\u0438\u0435 \u044f\u0447\u0435\u0439\u043a\u0438 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u0435\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c. \u041d\u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c vba \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043b\u0438\u0441\u0442, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0441\u043a\u043e\u043c\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u044d\u0442\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b (\u0431\u0435\u0437 \u043b\u0438\u0448\u043d\u0435\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f).<\/em>  <\/p>\n<p><code>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b Find \u0438\u043b\u0438 FindNext, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u043f\u0435\u0440\u0432\u0443\u044e \u044f\u0447\u0435\u0439\u043a\u0443 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u044f\u0447\u0435\u0439\u043a\u0443 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435. \u0417\u0430\u0442\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 Intersect, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u0415\u0441\u043b\u0438 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d, \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d \u0432\u0435\u0441\u044c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d.<\/code><\/p>\n<p><code>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0435\u0448\u0430\u0435\u0442 \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443:<\/code><\/p>\n<\/blockquote>\n<pre><code class=\"vbscript\">Function FindTableRange(sheet As Worksheet) As Range     Dim firstCell As Range     Dim lastCell As Range     Dim tableRange As Range          ' \u0418\u0449\u0435\u043c \u043f\u0435\u0440\u0432\u0443\u044e \u044f\u0447\u0435\u0439\u043a\u0443 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435     Set firstCell = sheet.Cells.Find(What:=\"*\", _                                       After:=sheet.Cells(1, 1), _                                       LookAt:=xlPart, _                                       SearchOrder:=xlByRows, _                                       SearchDirection:=xlNext, _                                       MatchCase:=False)                                            If Not firstCell Is Nothing Then         ' \u0418\u0449\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u044f\u0447\u0435\u0439\u043a\u0443 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435         Set lastCell = sheet.Cells.Find(What:=\"*\", _                                          After:=sheet.Cells(1, 1), _                                          LookAt:=xlPart, _                                          SearchOrder:=xlByRows, _                                          SearchDirection:=xlPrevious, _                                          MatchCase:=False)                                                   ' \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434 Intersect, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0435\u0437 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430         If Not Intersect(firstCell.EntireRow, sheet.UsedRange) Is Nothing And _            Not Intersect(lastCell.EntireRow, sheet.UsedRange) Is Nothing Then             Set tableRange = sheet.Range(firstCell, lastCell).Offset(1).Resize(lastCell.row - firstCell.row)         Else             Set tableRange = sheet.UsedRange         End If     Else         Set tableRange = sheet.UsedRange     End If          Set FindTableRange = tableRange End Function<\/code><\/pre>\n<p>\u041d\u0435\u043f\u043b\u043e\u0445\u043e, \u043d\u043e \u044d\u0442\u043e\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0443\u0436\u043d\u043e.<\/p>\n<p>\u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u043e\u043d \u0432\u0435\u0440\u043d\u0435\u0442 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d <code>A3:S28<\/code>, \u043a\u043e\u0433\u0434\u0430 \u0441\u0430\u043c\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 <code>C9:S28<\/code>:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0431\u0435\u0437\u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0445 \u043f\u043e\u043f\u044b\u0442\u043e\u043a, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u043c\u043e\u0447\u044c \u043d\u0435\u0439\u0440\u043e\u043d\u043a\u0435, \u0438 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c:<\/p>\n<blockquote>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0439\u0442\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<br \/>\u0414\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f <strong>\u0432\u0435\u0440\u0445\u043d\u0435\u0439<\/strong> \u0433\u0440\u0430\u043d\u0438\u0446\u044b, \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430, \u043d\u0430\u0439\u0442\u0438 \u0432 \u043d\u0438\u0445 \u043d\u043e\u043c\u0435\u0440\u0430 <em>\u043f\u0435\u0440\u0432\u044b\u0445<\/em> \u043d\u0435\u043f\u0443\u0441\u0442\u044b\u0445 \u0441\u0442\u0440\u043e\u043a \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0438\u0445 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432. \u041c\u0435\u0434\u0438\u0430\u043d\u0430 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u044d\u0442\u0438\u0445 \u0441\u0442\u0440\u043e\u043a \u2013 \u0432\u0435\u0440\u0445\u043d\u044f\u044f \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<br \/>\u0414\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f <strong>\u043d\u0438\u0436\u043d\u0435\u0439<\/strong> \u0433\u0440\u0430\u043d\u0438\u0446\u044b, \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430, \u043d\u0430\u0439\u0442\u0438 \u0432 \u043d\u0438\u0445 \u043d\u043e\u043c\u0435\u0440\u0430 <em>\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445<\/em> \u043d\u0435\u043f\u0443\u0441\u0442\u044b\u0445 \u0441\u0442\u0440\u043e\u043a \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0438\u0445 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432. \u041c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0438\u0437 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u044d\u0442\u0438\u0445 \u0441\u0442\u0440\u043e\u043a \u2013 \u043d\u0438\u0436\u043d\u044f\u044f \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<br \/>\u0414\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f <strong>\u043b\u0435\u0432\u043e\u0439 <\/strong>\u0433\u0440\u0430\u043d\u0438\u0446\u044b, \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430, \u043d\u0430\u0439\u0442\u0438 \u0432 \u043d\u0438\u0445 \u043d\u043e\u043c\u0435\u0440\u0430 <em>\u043f\u0435\u0440\u0432\u044b\u0445<\/em> \u043d\u0435\u043f\u0443\u0441\u0442\u044b\u0445 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0438\u0445 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432. \u041c\u0435\u0434\u0438\u0430\u043d\u0430 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u044d\u0442\u0438\u0445 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u2013 \u043b\u0435\u0432\u0430\u044f \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<br \/>\u0414\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f <strong>\u043f\u0440\u0430\u0432\u043e\u0439 <\/strong>\u0433\u0440\u0430\u043d\u0438\u0446\u044b, \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430, \u043d\u0430\u0439\u0442\u0438 \u0432 \u043d\u0438\u0445 \u043d\u043e\u043c\u0435\u0440\u0430 <em>\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 <\/em>\u043d\u0435\u043f\u0443\u0441\u0442\u044b\u0445 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0438\u0445 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432. \u041c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0438\u0437 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u044d\u0442\u0438\u0445 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u2013 \u043f\u0440\u0430\u0432\u0430\u044f \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<p><code>\u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 VBA \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/code>  <\/p>\n<\/blockquote>\n<pre><code class=\"vbscript\">Function FindTableRange(tableRange As Range) As Range      Dim numRows As Long     Dim numCols As Long     Dim row As Long     Dim col As Long     Dim topRow As Long     Dim bottomRow As Long     Dim leftCol As Long     Dim rightCol As Long     Dim topRows() As Long     Dim bottomRows() As Long     Dim leftCols() As Long     Dim rightCols() As Long          numRows = tableRange.rows.Count     numCols = tableRange.Columns.Count          ReDim topRows(1 To numCols)     ReDim bottomRows(1 To numCols)     ReDim leftCols(1 To numRows)     ReDim rightCols(1 To numRows)          For col = 1 To numCols         topRows(col) = tableRange.rows.Count         bottomRows(col) = 1         For row = 1 To numRows             If Not IsEmpty(tableRange(row, col)) Then                 If row &lt; topRows(col) Then topRows(col) = row                 If row > bottomRows(col) Then bottomRows(col) = row                 If leftCols(row) = 0 Then leftCols(row) = col                 rightCols(row) = col             End If         Next row     Next col          topRow = WorksheetFunction.Median(topRows)     bottomRow = WorksheetFunction.Max(bottomRows)     leftCol = WorksheetFunction.Median(leftCols)     rightCol = WorksheetFunction.Max(rightCols)          Set FindTableRange = Intersect(tableRange.Worksheet.Range(tableRange.Cells(topRow, leftCol), tableRange.Cells(bottomRow, rightCol)), tableRange.Worksheet.UsedRange)      End Function<\/code><\/pre>\n<p>\u0411\u0438\u043d\u0433\u043e! \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0434\u0430\u0435\u0442 \u0432\u0435\u0440\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u041d\u043e \u043c\u043d\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u0430\u043b\u043e. \u042f \u0445\u043e\u0447\u0443 \u043a\u043b\u0430\u0441\u0441, \u0438 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433, \u0438 \u0447\u0442\u043e\u0431 \u043f\u043e \u043a\u0440\u0430\u0441\u043e\u0442\u0435.<\/p>\n<p>\u041d\u0435 \u0431\u0435\u0437 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u043e\u043a, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u043e \u0441\u043f\u0443\u0441\u0442\u044f \u043c\u0438\u043d\u0443\u0442 30-40 (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435\/\u0431\u043e\u043b\u044c\u0448\u0435, \u043d\u0435 \u043f\u043e\u043c\u043d\u044e), \u044f \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<br \/>\u0414\u0430\u043b\u0435\u0435 \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Rubberduck:<\/p>\n<blockquote>\n<p><code>\u0425\u043e\u0440\u043e\u0448\u043e, \u044f \u043c\u043e\u0433\u0443 \u043f\u043e\u043c\u043e\u0447\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c unit-\u0442\u0435\u0441\u0442\u044b \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Rubberduck.<\/code><\/p>\n<p><code>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043d\u0430\u0447\u0430\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e Rubberduck \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u0432 Visual Studio.<\/code><\/p>\n<p><code>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0442\u0435\u0441\u0442\u043e\u0432. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 FindTableRange:<\/code><\/p>\n<\/blockquote>\n<pre><code class=\"vbscript\">Option Explicit '@TestModule '@Folder \"Tests\" Private Assert As Object @ModuleInitializee Public Sub ModuleInitialize() Set Assert = CreateObject(\"Rubberduck.AssertClass\") End Sub @ModuleCleanupp Public Sub ModuleCleanup() Set Assert = Nothing End Sub @TestMethodd Public Sub Test_FindTableRange_SimpleTable() 'Arrange Dim rng As Range Set rng = ThisWorkbook.Sheets(\"Sheet1\").Range(\"A1:C3\") 'Act Dim result As Range Set result = FindTableRange(rng)  'Assert Assert.AreEqual \"A2:C3\", result.Address  End Sub @TestMethodd Public Sub Test_FindTableRange_EmptyTable() 'Arrange Dim rng As Range Set rng = ThisWorkbook.Sheets(\"Sheet1\").Range(\"A1:C1\") 'Act Dim result As Range Set result = FindTableRange(rng)  'Assert Assert.IsNull result  End Sub @TestMethodd Public Sub Test_FindTableRange_TableWithEmptyRowsAndColumns() 'Arrange Dim rng As Range Set rng = ThisWorkbook.Sheets(\"Sheet1\").Range(\"A1:D5\") rng.Cells(2, 2).ClearContents rng.Cells(4, 3).ClearContents 'Act Dim result As Range Set result = FindTableRange(rng)  'Assert Assert.AreEqual \"B3:C4\", result.Address  End Sub @TestMethodd Public Sub Test_FindTableRange_TableWithHeader() 'Arrange Dim rng As Range Set rng = ThisWorkbook.Sheets(\"Sheet1\").Range(\"A1:C4\") rng.Cells(1, 1).Value = \"Header1\" rng.Cells(1, 2).Value = \"Header2\" rng.Cells(1, 3).Value = \"Header3\" 'Act Dim result As Range Set result = FindTableRange(rng)  'Assert Assert.AreEqual \"A2:C4\", result.Address  End Sub @TestMethodd Public Sub Test_FindTableRange_TableWithMultipleRanges() 'Arrange Dim rng As Range Set rng = ThisWorkbook.Sheets(\"Sheet1\").Range(\"A1:C3\") Dim rng2 As Range Set rng2 = ThisWorkbook.Sheets(\"Sheet1\").Range(\"D1:F3\") Dim multiRange As Range Set multiRange = Union(rng, rng2) 'Act Dim result As Range Set result = FindTableRange(multiRange)  'Assert Assert.AreEqual \"A2:F3\", result.Address  End Sub <\/code><\/pre>\n<blockquote>\n<p><code>\u042d\u0442\u0438 \u0442\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 FindTableRange, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0443\u0441\u0442\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043f\u0443\u0441\u0442\u044b\u043c\u0438 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438 \u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u043c\u0438, \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430\u043c\u0438 \u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430\u043c\u0438.<\/code><\/p>\n<p><code>\u0422\u0435\u0441\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Rubberduck, \u0432\u044b\u0431\u0440\u0430\u0432 \u043a\u043b\u0430\u0441\u0441 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432 \u043e\u043a\u043d\u0435 \"Unit Test Explorer\" \u0438 \u043d\u0430\u0436\u0430\u0432 \u043a\u043d\u043e\u043f\u043a\u0443 \"Run\".<\/code><\/p>\n<\/blockquote>\n<p>\u041d\u0435 \u0431\u0435\u0437 \u0432\u043e\u043f\u0440\u043e\u0441\u0438\u043a\u043e\u0432, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0432, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b.<br \/>\u041d\u0443 \u0438 \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a \u044f \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432 \u0441\u0442\u0438\u043b\u0435 VB.Net:<\/p>\n<blockquote>\n<p><code>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043a \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u043a\u043b\u0430\u0441\u0441\u0430:<\/code><\/p>\n<\/blockquote>\n<pre><code class=\"vbscript\">Option Explicit  ''' &lt;summary> ''' \u042d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0430 \u043b\u0438\u0441\u0442\u0435 Excel. ''' &lt;\/summary>  ''' &lt;summary> ''' \u041d\u0430\u0445\u043e\u0434\u0438\u0442 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 Range. ''' &lt;\/summary> ''' &lt;param name=\"rng\">\u0414\u0438\u0430\u043f\u0430\u0437\u043e\u043d Range, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0443.&lt;\/param> ''' &lt;returns>\u0414\u0438\u0430\u043f\u0430\u0437\u043e\u043d Range, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0443.&lt;\/returns> ''' &lt;example> ''' \u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f: ''' &lt;code><\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-406507","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/406507","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=406507"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/406507\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=406507"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=406507"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=406507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}