{"id":60,"date":"2019-04-04T22:22:04","date_gmt":"2019-04-04T22:22:04","guid":{"rendered":"https:\/\/keithratner.live\/optionexplicit\/?p=60"},"modified":"2019-11-22T02:10:22","modified_gmt":"2019-11-22T02:10:22","slug":"hashiddencolumns","status":"publish","type":"post","link":"https:\/\/keithratner.live\/optionexplicit\/hashiddencolumns\/","title":{"rendered":"HasHiddenColumns"},"content":{"rendered":"<pre>Public Function HasHiddenColumns( _\n  rng As Range _\n) As Boolean\n  Dim _\n    rngColumn As Range\n  HasHiddenColumns = False\n  For Each rngColumn In rng.Columns\n    If rngColumn.Hidden Then\n      HasHiddenColumns = True\n    End If\n  Next rngColumn\nEnd Function<\/pre>\n<p>Usage:<\/p>\n<pre>Dim _\n  wsSource As Worksheet, _\n  rngSource as Range\nSet wsSource = ThisWorkbook.Sheets(\"Sheet1\")\nSet rngSource = wsSource.Range(\"A1\", \"K32\")\nIf HasHiddenColumns( _\n  rngSource _\n) Then\n  ' Handle it\nEnd If\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Public Function HasHiddenColumns( _ rng As Range _ ) As Boolean Dim _ rngColumn As Range HasHiddenColumns = False For Each rngColumn In rng.Columns If rngColumn.Hidden Then HasHiddenColumns = True End If Next rngColumn End Function Usage: Dim _ wsSource As Worksheet, _ rngSource as Range Set wsSource = ThisWorkbook.Sheets(&#8220;Sheet1&#8221;) Set rngSource = wsSource.Range(&#8220;A1&#8221;, &#8220;K32&#8221;) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":61,"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_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5,4,6,3],"tags":[],"class_list":["post-60","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-code","category-distribution","category-snippets","category-vba"],"krwpengineoptions-featuredonwpengineblog":"","jetpack_featured_media_url":"https:\/\/i0.wp.com\/keithratner.live\/optionexplicit\/wp-content\/uploads\/sites\/29\/2019\/04\/hashiddencolumns.png?fit=277%2C187&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pgsIIA-Y","jetpack-related-posts":[{"id":137,"url":"https:\/\/keithratner.live\/optionexplicit\/transferfontproperties\/","url_meta":{"origin":60,"position":0},"title":"TransferFontProperties","author":"Keith","date":"April 24, 2019","format":false,"excerpt":"Public Sub TransferFontProperties( _ rngSource As Range, _ rngTarget As Range _ ) Dim sf As Font Set sf = rngSource.Font With rngTarget.Font .Name = sf.Name .Size = sf.Size .Strikethrough = sf.Strikethrough .Superscript = sf.Superscript .Underline = sf.Underline .Color = sf.Color .Italic = sf.Italic .TintAndShade = sf.TintAndShade .Subscript = sf.Subscript\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/keithratner.live\/optionexplicit\/category\/code\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/keithratner.live\/optionexplicit\/wp-content\/uploads\/sites\/29\/2019\/04\/TransferFontProperties.png?fit=295%2C283&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":110,"url":"https:\/\/keithratner.live\/optionexplicit\/deletehiddensourcecolumnsfromtarget\/","url_meta":{"origin":60,"position":1},"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;Code&quot;","block_context":{"text":"Code","link":"https:\/\/keithratner.live\/optionexplicit\/category\/code\/"},"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":[]},{"id":86,"url":"https:\/\/keithratner.live\/optionexplicit\/transferrangedataasarray\/","url_meta":{"origin":60,"position":2},"title":"TransferRangeDataAsArray","author":"Keith","date":"April 8, 2019","format":false,"excerpt":"Public Function TransferRangeDataAsArray( _ rngSource As Range, _ rngTarget As Range, _ Optional xlrvd As XlRangeValueDataType = xlRangeValueDefault _ ) As Range Set TransferRangeDataAsArray = _ rngTarget.Resize( _ rngSource.Rows.Count, _ rngSource.Columns.Count _ ) TransferRangeDataAsArray.Value( _ xlrvd _ ) = _ rngSource.Value( _ xlrvd _ ) End Function","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/keithratner.live\/optionexplicit\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":134,"url":"https:\/\/keithratner.live\/optionexplicit\/trimrange\/","url_meta":{"origin":60,"position":3},"title":"TrimRange","author":"Keith","date":"April 24, 2019","format":false,"excerpt":"Public Function TrimRange( _ rngSource As Range, _ Optional TrimTop As Integer = 0, _ Optional TrimBottom As Integer = 0, _ Optional TrimLeft As Integer = 0, _ Optional TrimRight As Integer = 0 _ ) As Range Set TrimRange = _ rngSource.Offset( _ rowoffset:=TrimTop, _ columnoffset:=TrimLeft _ ).Resize(\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/keithratner.live\/optionexplicit\/category\/code\/"},"img":{"alt_text":"TrimRange","src":"https:\/\/i0.wp.com\/keithratner.live\/optionexplicit\/wp-content\/uploads\/sites\/29\/2019\/04\/trimrange.png?fit=430%2C240&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":186,"url":"https:\/\/keithratner.live\/optionexplicit\/getlastusedrownumberinworksheet\/","url_meta":{"origin":60,"position":4},"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;Code&quot;","block_context":{"text":"Code","link":"https:\/\/keithratner.live\/optionexplicit\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":188,"url":"https:\/\/keithratner.live\/optionexplicit\/getlastusedcolumnnumberinworksheet\/","url_meta":{"origin":60,"position":5},"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;Code&quot;","block_context":{"text":"Code","link":"https:\/\/keithratner.live\/optionexplicit\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/posts\/60","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=60"}],"version-history":[{"count":3,"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/posts\/60\/revisions"}],"predecessor-version":[{"id":221,"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/posts\/60\/revisions\/221"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/media\/61"}],"wp:attachment":[{"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/media?parent=60"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/categories?post=60"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/tags?post=60"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}