Use of Array in Macro

Livin404

Well-known Member
Joined
Jan 7, 2019
Messages
743
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Greetings, I have a Macro which works great, but I need to add the letters "S" and "L". I'm pretty sure it will require an array. Looked for possible example and could not come accross one.

The current macro works greaat moving the A, but I need it to move an S and L too if found in Column R. These letters will be by themselves in Column R.

VBA Code:
Public Sub MoveLetters()
    Dim cell As Range
        Application.ScreenUpdating = False
        For Each cell In Range("R1:R" & Cells(Rows.Count, "R").End(xlUp).Row)
        If InStr(cell.Text, "A") > 0 Then
            cell.Offset(0, 1) = cell.Text
            cell.ClearContents
        End If
    Next cell
    
    Application.ScreenUpdating = True
    
End Sub


Thank you,
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,214,822
Messages
6,121,772
Members
449,049
Latest member
greyangel23

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