VBA - Check if next visible cell is blank

ElderWand

New Member
Joined
Apr 5, 2017
Messages
9
How could i use something like
Code:
ActiveCell.Offset(1, 0).Value = ""
to check if the next visible cell (not next cell down) while using autofilter is blank?



Code:
    ActiveSheet.Range("$K$2:$DF$199").AutoFilter Field:=61, Criteria1:="<>"
    
    If ActiveCell.Offset(1, 0).Value = "" Then
    Else
    Application.GoTo reference:="Ravenclaw"
    Call TomRiddle
    End If
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Code:
Dim rng As Range, cel As Range
ActiveSheet.Range("$K$2:$DF$199").AutoFilter Field:=61, Criteria1:="<>"
On Error Resume Next
Set rng = Range(ActiveCell, Cells(Rows.Count, ActiveCell.Column).End(xlUp)).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng Is Nothing Then
    For Each cel In rng
        Application.Goto reference:="Ravenclaw"
        Call TomRiddle
    Next
End If
 
Upvote 0
Or in case cells contain "" as the result of formulas :
Code:
Dim rng As Range, cel As Range
ActiveSheet.Range("$K$2:$DF$199").AutoFilter Field:=61, Criteria1:="<>"
On Error Resume Next
Set rng = Range(ActiveCell, Cells(Rows.Count, ActiveCell.Column).End(xlUp)).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng Is Nothing Then
    For Each cel In rng
        If cel <> "" Then
            Application.Goto reference:="Ravenclaw"
            Call TomRiddle
        End If
    Next
End If
 
Upvote 0
This worked great when there were only blanks but failed to work as expected when there were nonblanks (most likely from my vague question). It did point me in the right direction though. Thanks!
 
Upvote 0
Code:
ActiveSheet.Range("$K$2:$DF$608").AutoFilter Field:=61, Criteria1:="<>"
    
On Error GoTo Apparate3
For Each cell In Range("BS3:BS608").SpecialCells(xlCellTypeVisible)
Next cell


    Application.Goto reference:="Ravenclaw"
    Call TomRiddle


Apparate3:
Resume QWER
QWER:
 
Upvote 0

Forum statistics

Threads
1,216,101
Messages
6,128,844
Members
449,471
Latest member
lachbee

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