SpecialCells(xlCellTypeBlanks).Count

julhs

Active Member
Joined
Dec 3, 2018
Messages
448
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

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
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,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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