Macro to transfer contents of 'Selected' cell to alternate cell.

  • Thread starter Thread starter Gryndar
  • Start date Start date
G

Gryndar

I need a macro that will transfer contents of a cell that is currently
'selected / highlighted' to another cell, and if that cell is not blank then
to transfer the contents of the 'selected' cell to an alternate cell.
Merry Christmas Everyone!

Thanks,
Guy
 
The transfer would be initiated by clicking on a button that the macro would
be assigned to.
 
try this
Create a button using forms and assign this macro

Sub test()
Selection.Copy
ActiveCell.Offset(0, 1).Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
 
Best to stick with one thread.

See replies to your first posting.


Gord Dibben MS Excel MVP
 
That does not work. It only transfers info to adjacent cell. I need to
transfer contents from a currently sellected cell to a particular cell, (In
this case from whatever cell is sellected to C2 if blank or C3 if not blank).
 
To start with I want to thank everyone who has contributed to this, THANKS,
ya'll are great!
After trying all the formulas and noticing what each did I figured I could
combined a couple suggestions to get it to work. I used the original formula
from Luke M:
Sub CheckCell()
If Range("A2").Value = "" Then
Range("A2").Value = Range("C2").Value
Else
Range("A3").Value = Range("C2").Value
End If

End Sub
And substituted [Range("C2").Value] with [ActiveCell.Value] and it works
perfectly. I probably have just not been explaining it good enough to begin
with, sorry about that. The original formula almost worked but I didn't know
the syntax for using the sellected cell instead of 'C2' and couldn't figure
it out till the post by muddan madhu. His formula was not what I was looking
for but when I saw the syntax "ActiveCell" I figured maybe I could use that,
and it worked. I have learned a lot about these formulas from all this and
should be able to figure out some other stuff I have been wondering about
with this stuff.
Thanks a bunch everyone, ya'll have all been really great, I'm just not that
good at explaining sometimes.

MERRY CHRISTMAS!
 
If you had watched your original posting you would have seen my reply about
using the "Activecell"


Gord

To start with I want to thank everyone who has contributed to this, THANKS,
ya'll are great!
After trying all the formulas and noticing what each did I figured I could
combined a couple suggestions to get it to work. I used the original formula
from Luke M:
Sub CheckCell()
If Range("A2").Value = "" Then
Range("A2").Value = Range("C2").Value
Else
Range("A3").Value = Range("C2").Value
End If

End Sub
And substituted [Range("C2").Value] with [ActiveCell.Value] and it works
perfectly. I probably have just not been explaining it good enough to begin
with, sorry about that. The original formula almost worked but I didn't know
the syntax for using the sellected cell instead of 'C2' and couldn't figure
it out till the post by muddan madhu. His formula was not what I was looking
for but when I saw the syntax "ActiveCell" I figured maybe I could use that,
and it worked. I have learned a lot about these formulas from all this and
should be able to figure out some other stuff I have been wondering about
with this stuff.
Thanks a bunch everyone, ya'll have all been really great, I'm just not that
good at explaining sometimes.

MERRY CHRISTMAS!

Gord Dibben said:
Best to stick with one thread.

See replies to your first posting.


Gord Dibben MS Excel MVP
 
Sorry about that, I apologise. Been kinda hectic lately but no excuse. Sorry
and Thanks a bunch for all your help.
Merry Christmas!
Guy

Gord Dibben said:
If you had watched your original posting you would have seen my reply about
using the "Activecell"


Gord

To start with I want to thank everyone who has contributed to this, THANKS,
ya'll are great!
After trying all the formulas and noticing what each did I figured I could
combined a couple suggestions to get it to work. I used the original formula
from Luke M:
Sub CheckCell()
If Range("A2").Value = "" Then
Range("A2").Value = Range("C2").Value
Else
Range("A3").Value = Range("C2").Value
End If

End Sub
And substituted [Range("C2").Value] with [ActiveCell.Value] and it works
perfectly. I probably have just not been explaining it good enough to begin
with, sorry about that. The original formula almost worked but I didn't know
the syntax for using the sellected cell instead of 'C2' and couldn't figure
it out till the post by muddan madhu. His formula was not what I was looking
for but when I saw the syntax "ActiveCell" I figured maybe I could use that,
and it worked. I have learned a lot about these formulas from all this and
should be able to figure out some other stuff I have been wondering about
with this stuff.
Thanks a bunch everyone, ya'll have all been really great, I'm just not that
good at explaining sometimes.

MERRY CHRISTMAS!

Gord Dibben said:
Best to stick with one thread.

See replies to your first posting.


Gord Dibben MS Excel MVP

On Fri, 19 Dec 2008 18:48:01 -0800, Gryndar

I need a macro that will transfer contents of a cell that is currently
'selected / highlighted' to another cell, and if that cell is not blank then
to transfer the contents of the 'selected' cell to an alternate cell.
Merry Christmas Everyone!

Thanks,
Guy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top