SpecialCells(xlCellTypeBlanks).Count

julhs

Active Member
Joined
Dec 3, 2018
Messages
471
Office Version
  1. 2010
Platform
  1. Windows
Can anybody explain because I’m puzzled?
I have this that is working;
VBA Code:
Sub CountCheckIfBlank()
On Error Resume Next
If Range("A8:A50").SpecialCells(xlCellTypeBlanks).Count = 0 Then
Range("B23").Select
End
End If
If Range("A8:A50").SpecialCells(xlCellTypeBlanks).Count > 0 Then
Range("A23").Select
End If
End Sub
When even ever I step in and hover over the "xlCellTypeBlanks" part, it shows "=4"
I’m puzzle because the sub executes as expected under first “If” and second “If” condition, BUT the "xlCellTypeBlanks" part will ALL WAYS show "=4" regardless of whether there no blanks or 10.
So what exactly is "=4" if it’s not the number of blank cells?
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Many thanks for the clarification Fluff
For my ongoing learning process I needed to know why it returned what it did & why, I just need to remember it in the future?!!
Thank you as always.
Julhs
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

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