Help with simple code

P

pauluk

I am using the following code to delete certain cells depending on if o
cell is blank. I am having some problems can you help? I think it i
what i am using to represent a blank cell "="

Dim rng As Range
Dim rng2 As Range
Dim rng3 As Range
Dim rng4 As Range
Dim Rng5 As Range
Set rng = Worksheets("Sheet1").Range("B:B")
Set rng2 = Worksheets("Sheet1").Range("F:F")
Set rng3 = Worksheets("Sheet1").Range("J:J")
Set rng4 = Worksheets("Sheet1").Range("N:N")
Set Rng5 = Worksheets("Sheet1").Range("R:R")
If rng.Value = "=" Then
Range("A:A").Select
Selection.ClearContents
Range("C:C").Select
Selection.ClearContents
End I
 
C

Chip Pearson

Paul,

Why are you testing rng.Value for an equals sign? To test for an
empty cell, use "". E.g.,

If rng.Value = "" Then
' your code
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top