Insert blank cell then move cell in that row only if the cell contains a specific word anywhere in cell.

Livin404

Well-known Member
Joined
Jan 7, 2019
Messages
774
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello,
I'm confident I'm going in the right direction, but I know I must be misssing something. In column A starting at A2 I may have on occaision have the word "Bay" either by itself or with other text. I quite simply want to insert a blank cell in Column A by shifting the Cells in that row to the left.

I've been trying to use
S
VBA Code:
ub Move_Bay()
    Dim cell As Range
        Application.ScreenUpdating = False
        For Each cell In Range("A2:A" & Cells(Rows.Count, "A").End(xlUp).Row)
        If InStr(cell.Text, "bay") > 0 Then
            cell.Offset(0, 1) = cell.Text
            cell.ClearContents
        End If
    Next cell
        Application.ScreenUpdating = True
   End Sub

I thought I could use an "*" but that has no affect. I'm thinking I may have to use the word "CASE" somewhere in the macro.

Thank you,
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
How about
VBA Code:
If InStr(1, cell.Text, "bay", vbTextCompare) > 0 Then
 
Upvote 0
Solution
Thank you, I thought I would need an "*" but apparently not.

Thank you so much.
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,289
Members
452,902
Latest member
Knuddeluff

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