GOTO or FIND NEXT function - any suggestions please?

cheekyrich

Board Regular
Joined
Jun 2, 2005
Messages
102
Hi,

I have a range of data, lets say A1:D50. I am concerned only with column C. In that column, I want my VBA macro to go to (in turn) the next cell with the number '0330' in it (assuming all cells have different numbers). I will then perform a few bits of macro around that cell before my search will continue on to find the next '0330' in column C.

I know this is a simple one but have searched the forum and am getting all sorts except for the answer I need!

Thanks so much for your help in advance. Reeally appreciated,

Rich
 
Hi
Try
Code:
Private Sub CommandButton2_Click()
    
    TakeFocusOnClick = False
    Worksheets("GL07").Activate
    Application.ScreenUpdating = True
    Dim copyIndex As Integer
    Dim rowFound As Boolean
    rowFound = False
    copyIndex = 61
With Worksheets("GL07").

Dim r As Range, ff As String
Set r = .Range("G61:G1000").Find("xyz", .Range("G1000"), xlValues, xlPart,,xlPrevious)
If Not r Is Nothing Then
   ff = r.Address
   Do
            Set r = .Range("g61:g1000").FindNext(r)
            r.Offset(0, -5).Value = "'1001"
            r.Offset(0, -4).Value = "'1000"
            r.Offset(0, -3).Value = "'002"
            r.Offset(0, -2).Value = "'01"
            If Trim(r.Offset(0, 12).Text) = "te" Then
            r.Offset(0, -1).Value = "'1100"
            End If
   Loop Until ff = r.Address
End If
End With

End Sub
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,215,028
Messages
6,122,749
Members
449,094
Latest member
dsharae57

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