VBA code to jump to the next cell with contents within a column

Tommy_Oh_Boy

New Member
Joined
Sep 12, 2023
Messages
9
Office Version
  1. 365
Hi, Excel Grus

I desperately needs your expertise...
I'm hoping to create a VBA code that skip/jump to the next cell with contents (that's not blank) within a set range (i.e. column F10 to F2000).
I have different texts and numbers written on Column F, but not on every row/cell. the contents range from row 1 to row 2000.

How can I create a VBA code using a clickable button on the top by freezing panel) and click to go to the next cell with any contents (text or number) within a column? Hoping to save time scrolling down to find the next cell with contents.

I know how to make the button, but not the VBA code to make it work.
Let me know if my request is not clear.

Thanks in advance.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: VBA code to jump to the next cell with contents within a column
There is no need to repeat the link(s) provided above but if you have posted the question at other places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0
I got the similar code, but this seem to only work on finding numeric values.
How do I change this code to find the text value instead of numbers. (preferablly can be any value or text as long as it's not blank)


VBA Code:
Dim LastCell As Range

Sub FindIT()
Dim f As Range
Dim rngSearch As Range

With ActiveSheet
    Set rngSearch = .Range("F10:F2000")
    If LastCell Is Nothing Then Set LastCell = rngSearch.Cells(rngSearch.Rows.Count, rngSearch.Columns.Count)
    With rngSearch
        Set f = .Find(what:="*", after:=LastCell, lookat:=xlPart)
        If Not f Is Nothing Then
            Set LastCell = f
            f.Activate
            If Intersect(ActiveWindow.VisibleRange, f) Is Nothing Then
                ActiveWindow.ScrollRow = f.Row
            End If
        End If
    End With
End With
End Sub
 
Upvote 0
Try assigning the .Find Address into a Static variable and start your search after it.
 
Upvote 0
VBA Code:
Sub Find_Next_NonBlank()
Static startRng As Range
Dim wb As Workbook, sht As Worksheet, cell As Range, searchRng As Range
Set wb = ThisWorkbook: Set sht = wb.ActiveSheet: Set searchRng = sht.Columns(6)
If startRng Is Nothing Then
    Set startRng = searchRng.Cells(10, 1)
End If
searchRng.Find("*", startRng).Select
Set startRng = ActiveCell
End Sub
 
Upvote 0
Solution
Why not using in worksheet_SelectionChange, then using up/down arrow button to jump up/down cells with data in column?
It is better than click on button, I think.
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,312
Members
452,634
Latest member
cpostell

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