How can I write code to test if a cell is blank? My code is using "isempty" but I keep type mismatch error because my cells are filled with formulas that make the cells blank. It only works if the cells are truly empty with no formulas.
Thanks!
How can I write code to test if a cell is blank? My code is using "isempty" but I keep type mismatch error because my cells are filled with formulas that make the cells blank. It only works if the cells are truly empty with no formulas.
Thanks!
Try
If Range("A1").Value = "" Then
Ben Van Johnson
Thanks! Do you know how that would work in a For Each loop?
Like this?
![]()
Sub Check_Me() Dim c As Range For Each c In Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row) If c.Value = "" Then c.Select MsgBox "Hey look, I selected an empty cell although there might be a formula in it!" End If Next c End Sub
Hi,
For Each c In Worksheets("Sheet1").Range("A1:D10").Cells
If c.Value = "" Then
'' Do something
End If
Next
Where A1:D10 is the sample range i have taken as an example. Please change it accordingly.
Regards,
Paresh J
Click on "* Add Reputation" as a way to say thanks
Thank you so much!!
Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.
Posting code between [CODE] [/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.
Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
Regards
Fotis.
-This is my Greek whisper to Europe.
--Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.
Advanced Excel Techniques: http://excelxor.com/
--KISS(Keep it simple Stupid)
--Bring them back.
---See about Acropolis of Athens.
--Visit Greece.
That seems like it'll work as well! Thank you!
NON vba soluition
with an helpcolumn
d1if empty it returns zero (0)![]()
=len(a1)
Notice my main language is not English.
I appreciate it, if you reply on my solution.
If you are satisfied with the solution, please mark the question solved.
You can add reputation by clicking on the star * add reputation.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks