Nick Vittum
New Member
- Joined
- Apr 2, 2020
- Messages
- 26
- Office Version
- 365
- Platform
- Windows
I don't even know if loop is the proper term for what I want, but: I'm trying to come up with code that will allow my userform to find the first blank cell in Column B when I click a button, then skip to the next blank at the next click, and so on. I find lots of examples of code out there that will find the first blank in the column (or the last) but I can't find any that will cycle through the column. One I found that finds the first blank goes like this
Is it possible to adapt this to work through the whole column? Or does that "cycling through" require completely different code? (Also, if at all possible it needs to start on row 2, not 1. I can't even figure out how to do that with this code
Thanks!
VBA Code:
Sub NextBlank()
On Error Resume Next
Dim xCell As Range
For Each xCell In ActiveSheet.Columns(2).Cells
If Len(xCell) = 0 Then
xCell.Select
Exit For
End If
Next
End Sub
Thanks!