Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Stephane
 
Posts: n/a
Default How to move cell contents

Hi,

I need to move the content of a cell by x number of columns (i.e. A1 to A4)
but I cannot have a formula in the destination cell. How can I do that easily?

thanks,
  #2   Report Post  
JulieD
 
Posts: n/a
Default

Hi Stephane

not sure what you mean here, do you want to
1) take the value (which is derived from a formula in A1) and put it in A4
i.e. you have in A1 =B1-B2 and this gives an answer of 5, now you want the 5
(but not the formula in A4)
if so, then copy (or cut) A1, click in A4 and choose edit / paste special -
values

2) do you want to put the same value in A4, which is in A1 so that if A1
changes the value in A4 also changes
e.g. in A1 you have 7, you want the 7 also to appear in A4. If you change
the A1 7 to 5, then A4 should change to 5.
if so, and you don't want a formula in A4 you will need to use a
worksheet_change event (ie VBA code) - please let us know if this is what
you're after and we'll come up with the code for you.

something else entirely, if so, could you please provide a few more details.

Cheers
JulieD

"Stephane" wrote in message
...
Hi,

I need to move the content of a cell by x number of columns (i.e. A1 to
A4)
but I cannot have a formula in the destination cell. How can I do that
easily?

thanks,



  #3   Report Post  
Stephane
 
Posts: n/a
Default

Hi Julie,

the second option is what I am looking for.

thanks,

"JulieD" wrote:

Hi Stephane

not sure what you mean here, do you want to
1) take the value (which is derived from a formula in A1) and put it in A4
i.e. you have in A1 =B1-B2 and this gives an answer of 5, now you want the 5
(but not the formula in A4)
if so, then copy (or cut) A1, click in A4 and choose edit / paste special -
values

2) do you want to put the same value in A4, which is in A1 so that if A1
changes the value in A4 also changes
e.g. in A1 you have 7, you want the 7 also to appear in A4. If you change
the A1 7 to 5, then A4 should change to 5.
if so, and you don't want a formula in A4 you will need to use a
worksheet_change event (ie VBA code) - please let us know if this is what
you're after and we'll come up with the code for you.

something else entirely, if so, could you please provide a few more details.

Cheers
JulieD

"Stephane" wrote in message
...
Hi,

I need to move the content of a cell by x number of columns (i.e. A1 to
A4)
but I cannot have a formula in the destination cell. How can I do that
easily?

thanks,




  #4   Report Post  
JulieD
 
Posts: n/a
Default

Hi Stephane

okay, right mouse click on the sheet tab of the sheet where you want this to
happen and choose
view code
in the white area on the right of the screen paste the following code in
----
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$A$1" Then
Range("A4").Value = Range("A1").Value
End If

End Sub
---
now press the ALT & F11 keys to return to your workbook and test the code

Cheers
JulieD

"Stephane" wrote in message
...
Hi Julie,

the second option is what I am looking for.

thanks,

"JulieD" wrote:

Hi Stephane

not sure what you mean here, do you want to
1) take the value (which is derived from a formula in A1) and put it in
A4
i.e. you have in A1 =B1-B2 and this gives an answer of 5, now you want
the 5
(but not the formula in A4)
if so, then copy (or cut) A1, click in A4 and choose edit / paste
special -
values

2) do you want to put the same value in A4, which is in A1 so that if A1
changes the value in A4 also changes
e.g. in A1 you have 7, you want the 7 also to appear in A4. If you
change
the A1 7 to 5, then A4 should change to 5.
if so, and you don't want a formula in A4 you will need to use a
worksheet_change event (ie VBA code) - please let us know if this is what
you're after and we'll come up with the code for you.

something else entirely, if so, could you please provide a few more
details.

Cheers
JulieD

"Stephane" wrote in message
...
Hi,

I need to move the content of a cell by x number of columns (i.e. A1 to
A4)
but I cannot have a formula in the destination cell. How can I do that
easily?

thanks,






  #5   Report Post  
Stephane
 
Posts: n/a
Default

Hi Julie,

this seems to be exactly what I need but I have another twist for you:
imagine that I have to replicate this for a large number of cells.

thank you for you invaluable help!

"JulieD" wrote:

Hi Stephane

okay, right mouse click on the sheet tab of the sheet where you want this to
happen and choose
view code
in the white area on the right of the screen paste the following code in
----
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$A$1" Then
Range("A4").Value = Range("A1").Value
End If

End Sub
---
now press the ALT & F11 keys to return to your workbook and test the code

Cheers
JulieD

"Stephane" wrote in message
...
Hi Julie,

the second option is what I am looking for.

thanks,

"JulieD" wrote:

Hi Stephane

not sure what you mean here, do you want to
1) take the value (which is derived from a formula in A1) and put it in
A4
i.e. you have in A1 =B1-B2 and this gives an answer of 5, now you want
the 5
(but not the formula in A4)
if so, then copy (or cut) A1, click in A4 and choose edit / paste
special -
values

2) do you want to put the same value in A4, which is in A1 so that if A1
changes the value in A4 also changes
e.g. in A1 you have 7, you want the 7 also to appear in A4. If you
change
the A1 7 to 5, then A4 should change to 5.
if so, and you don't want a formula in A4 you will need to use a
worksheet_change event (ie VBA code) - please let us know if this is what
you're after and we'll come up with the code for you.

something else entirely, if so, could you please provide a few more
details.

Cheers
JulieD

"Stephane" wrote in message
...
Hi,

I need to move the content of a cell by x number of columns (i.e. A1 to
A4)
but I cannot have a formula in the destination cell. How can I do that
easily?

thanks,








  #6   Report Post  
Dave Peterson
 
Posts: n/a
Default

What is the large number of cells and where do you copy the value?

I'm guessing the cells are in column A and you always copy 3 columns to the
right (column D).

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myCell As Range
Dim myRng As Range

Set myRng = Nothing
On Error Resume Next
Set myRng = Intersect(Target, Me.Range("a:a"))
On Error GoTo 0

If myRng Is Nothing Then Exit Sub

On Error Resume Next 'keep going through all the cells
Application.EnableEvents = False
For Each myCell In myRng.Cells
myCell.Offset(0, 3).Value = myCell.Value
'myCell.ClearContents 'wipe out the old value?
Next myCell
Application.EnableEvents = True
On Error GoTo 0

End Sub


Stephane wrote:

Hi Julie,

this seems to be exactly what I need but I have another twist for you:
imagine that I have to replicate this for a large number of cells.

thank you for you invaluable help!

"JulieD" wrote:

Hi Stephane

okay, right mouse click on the sheet tab of the sheet where you want this to
happen and choose
view code
in the white area on the right of the screen paste the following code in
----
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$A$1" Then
Range("A4").Value = Range("A1").Value
End If

End Sub
---
now press the ALT & F11 keys to return to your workbook and test the code

Cheers
JulieD

"Stephane" wrote in message
...
Hi Julie,

the second option is what I am looking for.

thanks,

"JulieD" wrote:

Hi Stephane

not sure what you mean here, do you want to
1) take the value (which is derived from a formula in A1) and put it in
A4
i.e. you have in A1 =B1-B2 and this gives an answer of 5, now you want
the 5
(but not the formula in A4)
if so, then copy (or cut) A1, click in A4 and choose edit / paste
special -
values

2) do you want to put the same value in A4, which is in A1 so that if A1
changes the value in A4 also changes
e.g. in A1 you have 7, you want the 7 also to appear in A4. If you
change
the A1 7 to 5, then A4 should change to 5.
if so, and you don't want a formula in A4 you will need to use a
worksheet_change event (ie VBA code) - please let us know if this is what
you're after and we'll come up with the code for you.

something else entirely, if so, could you please provide a few more
details.

Cheers
JulieD

"Stephane" wrote in message
...
Hi,

I need to move the content of a cell by x number of columns (i.e. A1 to
A4)
but I cannot have a formula in the destination cell. How can I do that
easily?

thanks,







--

Dave Peterson
  #7   Report Post  
Earl Kiosterud
 
Posts: n/a
Default

Stephanie,

You didn't tell all. Did you mean move, or copy? If the cell in A1 contains
a value (non-formula), you can move it to A4 by cutting/pasting, or more
easily be dragging it by it's border. If the cell contains a formula, and
you want the result of the formula in A4, you can do that by doing Copy,
then in A4 do Paste special - Values. Now delete A1. If neither is the
solution you need, perhaps you can describe what's going in in more detail.

--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

"Stephane" wrote in message
...
Hi,

I need to move the content of a cell by x number of columns (i.e. A1 to
A4)
but I cannot have a formula in the destination cell. How can I do that
easily?

thanks,



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
can't move a named cell without breaking a hyperlink to that cell Snakeye Links and Linking in Excel 3 January 26th 05 11:57 PM
excel tab key to move to right adjacent cell dwillie Excel Discussion (Misc queries) 2 January 26th 05 08:01 PM
Checkbox not part of cell. (???) Cells can move "underneath". (!!!) Thomas G. Marshall Excel Discussion (Misc queries) 4 December 18th 04 04:15 PM
Cell contents vs. Formula contents Sarah Excel Discussion (Misc queries) 3 December 15th 04 06:02 PM
Display actual contents of cell xmasbob Excel Discussion (Misc queries) 1 December 6th 04 05:09 PM


All times are GMT +1. The time now is 12:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"