VBA Insert specific text in one cell if another cell contains the word "Delivery".

Livin404

Well-known Member
Joined
Jan 7, 2019
Messages
743
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I have a formula that will input specific text in once cell if data is found in another.

The Formula I am using is =IF(H8="Delivery" ,"Refer to Company Guidance")

I would like have a VBA determine that if cell H8 contains the text "Delivery" in any part of the cell, then the text "Refer to Company Guidance" will be inserted in cell H12.

Thank you,
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
VBA Code:
If ActiveSheet.Range("H8").Value = "Delivery" Then
ActiveSheet.Range("H12").Value = "Refer to Company Guidance"
End If
 
Upvote 0
VBA Code:
If ActiveSheet.Range("H8").Value = "Delivery" Then
ActiveSheet.Range("H12").Value = "Refer to Company Guidance"
End If
That is correct, but I may have some like "/Delivery". So if delivery is anywhere in the cell. I think "Case" has to be written some place.

Thank you,
 
Upvote 0
Hi Livin404,
try this code:

VBA Code:
If InStr(UCase(ActiveSheet.Range("H8").Value), "DELIVERY") Then
ActiveSheet.Range("H12").Value = "Refer to Company Guidance"
End If
 
Upvote 0
Solution
Hi Livin404,
try this code:

VBA Code:
If InStr(UCase(ActiveSheet.Range("H8").Value), "DELIVERY") Then
ActiveSheet.Range("H12").Value = "Refer to Company Guidance"
End If
Thank you, I think that will do it. much appreciated.
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,530
Members
448,969
Latest member
mirek8991

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