Custom Function to find value and offset

silentwolf

Well-known Member
Joined
May 14, 2008
Messages
1,216
Office Version
  1. 2016
Hi guys,
I am in need for help.(
I would like to write a custom function which findes certain values and offset once it is found two columns to the right.

Code:
function Test(strText as string) as string
Select Case True
Case strText = "Good"
?? offset found cell one column to the right get and modify that cell
Case strText="Bad"
?? offset found cell one column to the right get and modify that cell
Case strText ="Worst"
?? offset found cell one column to the right get and modify that cell
Case else

End select
end function

That is what I like to have but I am not able to get it to work...

Many thanks for your helb

Greetings

Albert
 
Try this, remove the Offset(,3) from the last line - I was using that to check the results without overwriting the original data.
Code:
Sub UpdateUmsatz()
Dim arr As Variant
Dim I As Long

    arr = Range("I2", Range("J" & Rows.Count).End(xlUp)).Value
    
    For I = LBound(arr) To UBound(arr)
        If arr(I, 1) = "SEPA-Lastschrift" Then
            arr(I, 2) = LastschriftenTextUpdate(arr(I, 2))
        End If
    Next I
    
    Range("I2", Range("J" & Rows.Count).End(xlUp)).Offset(, 3).Value = arr
    
End Sub
 
Upvote 0

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Norie,
that works .-) oh my goodness you are a legend .-) !!!!!!!!!
Well it worked for you too didn t it?

Many thanks to you my friend!!!!
 
Upvote 0

Forum statistics

Threads
1,214,859
Messages
6,121,963
Members
449,059
Latest member
oculus

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