Sub MoveRight()
Dim rFound As Range
Dim lFirstCol As Long
Dim rSearch As Range
Const sSEARCH As String = "A"
Set rSearch = Sheet1.Cells
'Find the first instance in the right most column
Set rFound = rSearch.Find(sSEARCH, rSearch.Cells(1), xlValues, xlWhole, xlByColumns, xlPrevious, True)
'If a cell was found
If Not rFound Is Nothing Then
'Record the column so we know when to stop
lFirstCol = rFound.Column
'loop through all the found cells
Do
rFound.Offset(0, 1).Value = rFound.Value
rFound.ClearContents
Set rFound = rSearch.FindPrevious(rFound)
'stop when it wraps back around and finds the first
'instance that you moved one cell to the right
Loop Until rFound.Column > lFirstCol
End If
End Sub
Убедитесь, что вы сохранили резервную копию вашего файла перед запуском этого макроса.Если он не делает то, что вы хотите, нет отмены.