[VBA] how to detect empty cells with hidden formatting etc that usedrange will detect?

excellol

New Member
Joined
May 5, 2020
Messages
19
Office Version
  1. 2019
Platform
  1. Windows
sometimes the usedrange.select returns an empty cell even though the data ended on the previous row. google results mentioned that there is some hidden formatting that is not easily detected.

i find that this happens when i run a macro that inputs values into cells and i subsequently delete the newly inputted data manually using the delete key

is there a vba code that will detect these hidden formatting and alert the user?
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
37,454
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
I usually don't worry about that and simply calculate the last row and column displaying "something" and use them to control what my code processes (these code lines ignore formulas returning the empty text string "")...

LastUsedRow = Cells.Find("*", , xlValues, , xlRows, xlPrevious).Row

LastUsedCol = Cells.Find("*", , xlValues, , xlByColumns, xlPrevious).Column
 

Forum statistics

Threads
1,143,677
Messages
5,720,259
Members
422,273
Latest member
linds75

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
Top