Help needed with this code!!! Thank you :-)

cheekyrich

Board Regular
Joined
Jun 2, 2005
Messages
102
Hi all,

I am almost done but I need help tweaking this code. Can someone fix this code for me? Am completely at a loss!!!

Background: I have a range of data, lets say G61:G1000. In that column, I want my VBA macro to go to (in turn) the next cell with the number 'xyz' 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. The macro i want to perform around the cell is below - it involves looking at cells on the corresponding row and changing them, before continuing with the search.

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



Worksheets("GL07").Activate
Dim r As Range, ff As String
Set r = Range("G61:G1000").Find("xyz", Range("G1000"), , xlPart)
If Not r Is Nothing Then
ff = r.Address
Do
ActiveCell.Offset(0, -5).Select
ActiveCell.FormulaR1C1 = "'1001"
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = "'1000"
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = "'002"
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = "'01"
ActiveCell.Offset(0, 1).Select
If Trim(Sheet1.Cells(i, "S").Text) = "te" Then
ActiveCell.FormulaR1C1 = "'1100"
End If

Set r = Range("G61:G1000").FindNext(r)
Loop Until ff = r.Address Or r Is Nothing
End If
 

Some videos you may like

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Watch MrExcel Video

Forum statistics

Threads
1,113,950
Messages
5,545,139
Members
410,665
Latest member
origamistudios
Top