Moving a cell value to another cell using formula.

Roger S

New Member
Joined
Mar 5, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Question please:-

If i have a number value in cell A1 and by puting an "X" in cell A2, the number value will move to cell A3 automatically, leaving cell A1 blank.
 

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.
Hi,

A formula cannot fully handle your request ...
You could test following event macro
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
If Target.Row Mod 2 = 1 Then Exit Sub
    With Target
        If UCase(.Value) = "X" Then
            .Offset(1, 0).Value = .Offset(-1, 0).Value
            .Offset(-1, 0).ClearContents
        End If
    End With
End Sub
 
Upvote 0
Hi,

A formula cannot fully handle your request ...
You could test following event macro
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
If Target.Row Mod 2 = 1 Then Exit Sub
    With Target
        If UCase(.Value) = "X" Then
            .Offset(1, 0).Value = .Offset(-1, 0).Value
            .Offset(-1, 0).ClearContents
        End If
    End With
End Sub

Thanks James, i will give it a try.

One question please, there are other formuli in the same sheets, will the be effected by adding this code?
 
Upvote 0
Three quick remarks :
1. Macro can very easily be restricted to a predefined area
2. As a general rule rule, there should be no interference ... but ...
3. What precisely are the formulas you are talking about and where are they located ?
 
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,186
Members
449,071
Latest member
cdnMech

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