# moving cell contents to add to another cell

#### bcuzican

##### New Member
i need the number of a cell to move to another cell
but it only needs to move if its a certain type of number

i need the for the amount in "b" cell to move to the "c" cell, but only if there is input in the "a" cell

### Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
It's not going to move perse but you can use a formula in C to pull that number depending on what you have in A.

In C1:
=if(a1<>"","",b1)

If a1 is blank then c1 will be blank.
If there is anything entered in a1 then c1 will reflect what's in b1.

Now, what happens to b1? You want it blank? Does b1 pick up a value from somewhere else?

Welcome to the Board!

The following code will cut the contents of column B and move it to column C whenever anything is entered into column A.

<font face=Tahoma><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Worksheet_Change(<SPAN style="color:#00007F">ByVal</SPAN> Target <SPAN style="color:#00007F">As</SPAN> Range)
<SPAN style="color:#00007F">Dim</SPAN> rng <SPAN style="color:#00007F">As</SPAN> Range
<SPAN style="color:#007F00">'   Only look at single cell changes</SPAN>
<SPAN style="color:#00007F">If</SPAN> Target.Count > 1 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
<SPAN style="color:#00007F">Set</SPAN> rng = Range("A:A")
<SPAN style="color:#007F00">'   Only look at that range</SPAN>
<SPAN style="color:#00007F">If</SPAN> Intersect(Target, rng) <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
<SPAN style="color:#00007F">If</SPAN> Target <> "" <SPAN style="color:#00007F">Then</SPAN> Target.Offset(, 1).Cut Target.Offset(, 2)
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
</FONT>

Right click the sheet tab, select View Code and paste it in the module window that opens. You can then exit back to Excel to test it.

Hope that helps,

Smitty

But if you add something new to column A then Column C will go blank, right?

What if you delete the value in Column A... will this reverse?

FinancialAnalystKid said:
But if you add something new to column A then Column C will go blank, right?
Yes.
FinancialAnalystKid said:
What if you delete the value in Column A... will this reverse?
No.

LOL

I figured it wouldn't reverse I was just posing a question on the possibilites. to maybe add a command that states, if A changes to "" and if there's a value in C, then it goes to B if B is blank.

IT'S CRAZINESS!

But what if the user isn't being specific as he mentioned: "but it only needs to move if its a certain type of number"...

Not just on 'input' but based on a 'certain type of number'.

bcuzican - can you be more specific on your needs?

FAK

Yup, mine really only addresses a generic issue, but can certainly be tweaked dependent upon the OP's needs. It's just a possible start. :wink:

Smitty

Replies
9
Views
218
Replies
12
Views
438
Replies
5
Views
181
Replies
14
Views
627
Replies
0
Views
105

### Forum statistics

1,221,053
Messages
6,157,640
Members
451,426
Latest member
VinnyDoesntKnowExcelCode

### 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.

### Which adblocker are you using?

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

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