#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copy cell


Hi - I need a macro to copy the plain text value in B1 to the firs
empty cell in column A. Any help will be greatly appreciated.
Thanks

--
elrussel
-----------------------------------------------------------------------
elrussell's Profile: http://www.excelforum.com/member.php...fo&userid=3102
View this thread: http://www.excelforum.com/showthread.php?threadid=51812

  #2   Report Post  
Posted to microsoft.public.excel.programming
Udo Udo is offline
external usenet poster
 
Posts: 48
Default copy cell

Hi

this may not be very sophisticated but it works

Sub CopCell()

ActiveSheet.Range("B1").Select
Selection.Copy
ActiveSheet.Range("a1").Select
If Selection.Value = "" Then 'checks if A1 is free already
GoTo InsertValue
Else
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
GoTo InsertValue
End If


Exit Sub
InsertValue:
ActiveSheet.Paste
Application.CutCopyMode = False

End Sub


Good luck
Udo

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default copy cell

Range("A1").End(xlDown).value = range("B1").value

HTH

--
AP

"elrussell" a écrit
dans le message de
...

Hi - I need a macro to copy the plain text value in B1 to the first
empty cell in column A. Any help will be greatly appreciated.
Thanks.


--
elrussell
------------------------------------------------------------------------
elrussell's Profile:

http://www.excelforum.com/member.php...o&userid=31020
View this thread: http://www.excelforum.com/showthread...hreadid=518125



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default copy cell

Ooops!
Range("A1").End(xlDown).offset(1,0).value = range("B1").value

--
AP

"Ardus Petus" a écrit dans le message de
...
Range("A1").End(xlDown).value = range("B1").value

HTH

--
AP

"elrussell" a

écrit
dans le message de
...

Hi - I need a macro to copy the plain text value in B1 to the first
empty cell in column A. Any help will be greatly appreciated.
Thanks.


--
elrussell
------------------------------------------------------------------------
elrussell's Profile:

http://www.excelforum.com/member.php...o&userid=31020
View this thread:

http://www.excelforum.com/showthread...hreadid=518125





  #5   Report Post  
Posted to microsoft.public.excel.programming
Udo Udo is offline
external usenet poster
 
Posts: 48
Default copy cell

Hi Ardus,

that's really good, I like it, much better and straight forward than my
suggestion!
It only has a minor problem: if column A is not yet filled at all, it
will put the value into A2, not A1. So perhaps we should write:
if Range("A1").Value = "" then
Range("A1").value= range ("B1").Value
else
Range("A1").End(xlDown).offset(1,0).value = range("B1").value
End if

Udo



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copy cell


thanks everyone! I appreciate the good thoughts.


--
elrussell
------------------------------------------------------------------------
elrussell's Profile: http://www.excelforum.com/member.php...o&userid=31020
View this thread: http://www.excelforum.com/showthread...hreadid=518125

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copy cell


The code below works great - but only once. That is, it does not move
down the empty column on subsequent calls. The content is placed
correctly in the first empty cell, but the code does not seem to be
able to detect that here is new content in the cell and move on. Do I
need to initialize a variable? I have tried testing the cell several
ways:


If Range("E9").Value = " " Then
If Range("E9").Value = 0 Then


neither detect the empty cell.
Here is the code that works 'once'.



Sub copyCell()

'L6 holds copy of Earned Points

If Range("E9").Value = "" Then
Range("E9").Value = Range("L6").Value
Else
Range("E9").End(xlDown).Offset(0, 0).Value = Range("L6").Value
End If

End Sub


--
elrussell
------------------------------------------------------------------------
elrussell's Profile: http://www.excelforum.com/member.php...o&userid=31020
View this thread: http://www.excelforum.com/showthread...hreadid=518125

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
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Options Yuvraj Excel Discussion (Misc queries) 0 June 29th 09 11:20 AM
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Yuvraj Excel Discussion (Misc queries) 0 June 26th 09 06:01 PM
How can I copy a value from a cell and paste it into another cell while adding it to the previous value in that cell [email protected] Excel Worksheet Functions 2 November 7th 07 09:39 AM
I copy a formula and the results copy from the original cell brooklynsd Excel Discussion (Misc queries) 1 June 23rd 07 01:35 AM
VBA to copy to empty cell directly below a cell when analogous cells in different column have same value as each other? SROSENYC Excel Programming 1 August 5th 03 04:34 AM


All times are GMT +1. The time now is 04:41 AM.

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

About Us

"It's about Microsoft Excel"