for each cell in range

cvraman

New Member
Joined
Dec 26, 2015
Messages
12
Hi guys,
I'd like to ask help regarding the below code:
1. why the below code runs infenitly?
2.Could somebody help me how to do the below ones without the temp string? I mean to use something like if cell.find("backup") is ..... then

dim temp as string

For Each cell In Range("I37:I40").Cells
On Error Resume Next
temp = cell.Find("Backup")
If temp <> "" Then
cell.Offset(0, 5) = temp
temp = Empty
End If
Next



thanks for your help
Tamas
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
What do you really want to displace in the offset cell

Code:
Sub ForCode()
    Dim Cell As Range
    For Each Cell In Range("I37:I40")
        On Error Resume Next
        If Cell.Find("Backup") <> "" Then
            Cell.Offset(0, 5) = Cell.Find("Backup")
        End If
    Next
End Sub
 
Upvote 0
sorry it is my mistake.
for the first question is a complete disaster cause I left a the above mentioned code in a Do loop
regarding the second question releated also to your question i find some answer:

For Each cell In Range(Cells(38, 9), Cells(lastrow, 9)).Cells
If Not cell.Find("Backup") Is Nothing Then
cell.Offset(0, 5) = "ok"
End If
Next cell

I wanted to use the offset to make a result to a cell shifted to another column compared to the checked one if the criteria is met.

thanks you
 
Upvote 0
So, are you all set now, or is there still some question?
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,394
Members
448,957
Latest member
Hat4Life

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