moving cell contents to add to another cell

bcuzican

New Member
Joined
Jan 18, 2005
Messages
1
I'm working on a spreadsheet
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

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
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?
 
Upvote 0
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
 
Upvote 0
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?
 
Upvote 0
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.
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,213,511
Messages
6,114,054
Members
448,543
Latest member
MartinLarkin

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