Help Selecting Every Column Without Text

RunTime91

Active Member
Joined
Aug 30, 2012
Messages
290
Office Version
  1. 365
Greetings ~

I have a sheet with records and the rest of the sheet (all the way out to column WXT) has some sort of formating so when I try to get a column count it brings back 16112 columns

instead of the 64 with actual data


My approach is to simply delete the cells in row 1 which lie beyond the last cell with an actual header name -


I am currently using just to make sure I'm selecting every cell in the 1st row beyond the header fields and, of course it does not
Code:
Range("A1").End(xlToRight).Offset(0, 1).Resize(, Columns.End(xlToRight).Column).Select


So how can I clear all cells beyond the actual data rows/fields so they wont get counted?


Thank you for you help
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hello Runtime91,

What code are you using to count the cells?

Are there columns with headers and no data?
 
Upvote 0
Hey Leith ~!

Thank you so much for stepping in on this ~

I found a solution in the code below
Code:
Foo = Sheet1.UsedRange.Rows.Count
Foo = Sheet1.UsedRange.Columns.Count
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,624
Latest member
gregg777

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top