{"id":214,"date":"2019-09-11T19:17:25","date_gmt":"2019-09-11T19:17:25","guid":{"rendered":"https:\/\/keithratner.live\/optionexplicit\/?p=214"},"modified":"2019-09-11T19:23:02","modified_gmt":"2019-09-11T19:23:02","slug":"deleteinitialcolumnsfromworksheet","status":"publish","type":"post","link":"https:\/\/keithratner.live\/optionexplicit\/deleteinitialcolumnsfromworksheet\/","title":{"rendered":"DeleteInitialColumnsFromWorksheet"},"content":{"rendered":"<p>Note: This function depends on <a href=\"https:\/\/keithratner.live\/optionexplicit\/returnname\/\" rel=\"noopener noreferrer\" target=\"_blank\">ReturnName<\/a><\/p>\n<pre>Sub DeleteInitialColumnsFromWorksheet( _\r\n    ws As Worksheet, _\r\n    NumberOfColumns As Integer _\r\n)\r\n    With ws\r\n        .Columns( _\r\n            ReturnName( _\r\n                1 _\r\n            ) & _\r\n            \":\" & _\r\n            ReturnName( _\r\n                NumberOfColumns _\r\n            ) _\r\n        ).Delete _\r\n            Shift:=xlToLeft\r\n    End With\r\nEnd Sub<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Note: This function depends on ReturnName Sub DeleteInitialColumnsFromWorksheet( _ ws As Worksheet, _ NumberOfColumns As Integer _ ) With ws .Columns( _ ReturnName( _ 1 _ ) &#038; _ &#8220;:&#8221; &#038; _ ReturnName( _ NumberOfColumns _ ) _ ).Delete _ Shift:=xlToLeft End With End Sub<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[114],"tags":[121,154],"class_list":["post-214","post","type-post","status-publish","format-standard","hentry","category-snippet","tag-excel","tag-worksheet"],"krwpengineoptions-featuredonwpengineblog":"","jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pgsIIA-3s","jetpack-related-posts":[{"id":190,"url":"https:\/\/keithratner.live\/optionexplicit\/deletebottomrowsfromworksheet\/","url_meta":{"origin":214,"position":0},"title":"DeleteBottomRowsFromWorksheet","author":"Keith","date":"August 14, 2019","format":false,"excerpt":"Note: This method depends on GetLastUsedRowNumberInWorksheet Sub DeleteBottomRowsFromWorksheet( _ ws As Worksheet _ ) Dim _ strStartingEmptyRow As String, _ rngStartingRow As Range, _ rngEmptyRows As Range, _ lngLastRow As Long lngLastRow = _ GetLastUsedRowNumberInWorksheet( _ ws _ ) If lngLastRow = _ -1 Then Exit Sub End If strStartingEmptyRow\u2026","rel":"","context":"In &quot;Snippet&quot;","block_context":{"text":"Snippet","link":"https:\/\/keithratner.live\/optionexplicit\/category\/snippet\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":177,"url":"https:\/\/keithratner.live\/optionexplicit\/workbooksheetexists\/","url_meta":{"origin":214,"position":1},"title":"WorkbookSheetExists","author":"Keith","date":"July 10, 2019","format":false,"excerpt":"Public Function WorkbookSheetExists( _ wb As Workbook, _ strSheetName As String _ ) As Boolean Dim ws As Worksheet WorkbookSheetExists = False For Each ws In wb.Sheets If ws.Name = strSheetName Then WorkbookSheetExists = True End If Next ws End Function","rel":"","context":"In &quot;Snippet&quot;","block_context":{"text":"Snippet","link":"https:\/\/keithratner.live\/optionexplicit\/category\/snippet\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":182,"url":"https:\/\/keithratner.live\/optionexplicit\/deleteallslicersfromworkbook\/","url_meta":{"origin":214,"position":2},"title":"DeleteAllSlicersFromWorkbook","author":"Keith","date":"August 12, 2019","format":false,"excerpt":"Public Function DeleteAllSlicersFromWorkbook( _ wb As Workbook _ ) Dim _ ws As Worksheet, _ shp As Shape For Each ws In wb.Sheets For Each shp In ws.Shapes If shp.Type = msoSlicer Then shp.Delete Next shp Next ws End Function","rel":"","context":"In &quot;Snippet&quot;","block_context":{"text":"Snippet","link":"https:\/\/keithratner.live\/optionexplicit\/category\/snippet\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":186,"url":"https:\/\/keithratner.live\/optionexplicit\/getlastusedrownumberinworksheet\/","url_meta":{"origin":214,"position":3},"title":"GetLastUsedRowNumberInWorksheet","author":"Keith","date":"August 14, 2019","format":false,"excerpt":"Function GetLastUsedRowNumberInWorksheet( _ ws As Worksheet _ ) As Long Dim _ rng As Range, _ rngResults As Range Set rng = _ ws.Cells Set rngResults = _ rng.Find( _ what:=\"*\", _ After:=rng.Cells(1), _ Lookat:=xlPart, _ LookIn:=xlFormulas, _ SearchOrder:=xlByRows, _ SearchDirection:=xlPrevious, _ MatchCase:=False _ ) If _ rngResults Is Nothing\u2026","rel":"","context":"In &quot;Snippet&quot;","block_context":{"text":"Snippet","link":"https:\/\/keithratner.live\/optionexplicit\/category\/snippet\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":188,"url":"https:\/\/keithratner.live\/optionexplicit\/getlastusedcolumnnumberinworksheet\/","url_meta":{"origin":214,"position":4},"title":"GetLastUsedColumnNumberInWorksheet","author":"Keith","date":"August 14, 2019","format":false,"excerpt":"Function GetLastUsedColumnNumberInWorksheet( _ ws As Worksheet _ ) As Long Dim _ rng As Range, _ rngResults As Range Set rng = _ ws.Cells Set rngResults = _ rng.Find( _ what:=\"*\", _ After:=rng.Cells(1), _ Lookat:=xlPart, _ LookIn:=xlFormulas, _ SearchOrder:=xlByColumns, _ SearchDirection:=xlPrevious, _ MatchCase:=False _ ) If _ rngResults Is Nothing\u2026","rel":"","context":"In &quot;Snippet&quot;","block_context":{"text":"Snippet","link":"https:\/\/keithratner.live\/optionexplicit\/category\/snippet\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":110,"url":"https:\/\/keithratner.live\/optionexplicit\/deletehiddensourcecolumnsfromtarget\/","url_meta":{"origin":214,"position":5},"title":"DeleteHiddenSourceColumnsFromTarget","author":"Keith","date":"April 9, 2019","format":false,"excerpt":"Public Sub DeleteHiddenSourceColumnsFromTarget( _ rngSource As Range, _ rngTarget As Range _ ) Dim _ rngColumn As Range, _ intSourceColumnInitialOffset As Integer, _ intSourceRowInitialOffset As Integer, _ iColumn As Integer With rngSource.Cells(1, 1) intSourceColumnInitialOffset = .Column intSourceRowInitialOffset = .Row End With For iColumn = rngSource.Columns.Count To 1 Step -1 If\u2026","rel":"","context":"In &quot;Snippet&quot;","block_context":{"text":"Snippet","link":"https:\/\/keithratner.live\/optionexplicit\/category\/snippet\/"},"img":{"alt_text":"DeleteHiddenSourceColumnsFromTarget","src":"https:\/\/i0.wp.com\/keithratner.live\/optionexplicit\/wp-content\/uploads\/sites\/29\/2019\/04\/deletehiddensourcecolumnsfromtarget.png?fit=392%2C288&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/posts\/214","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/comments?post=214"}],"version-history":[{"count":2,"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/posts\/214\/revisions"}],"predecessor-version":[{"id":218,"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/posts\/214\/revisions\/218"}],"wp:attachment":[{"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/media?parent=214"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/categories?post=214"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/tags?post=214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}