ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy and paste macro (https://www.excelbanter.com/excel-programming/377524-copy-paste-macro.html)

Bears

Copy and paste macro
 
I am trying to write a macro to copy the contents of the cell that the
cursor is in and paste it two columns over into all the cells that are
blank from that row and up until the next cell with something in it. I
just can't get the column offset correct- Help would be appreciated.


Don Guillett

Copy and paste macro
 
As always, post YOUR code for comments

--
Don Guillett
SalesAid Software

"Bears" wrote in message
oups.com...
I am trying to write a macro to copy the contents of the cell that the
cursor is in and paste it two columns over into all the cells that are
blank from that row and up until the next cell with something in it. I
just can't get the column offset correct- Help would be appreciated.




[email protected]

Copy and paste macro
 
Hi
This should do it without the paste. Untested, so you will probably get
an error if target is on the first row and you want to go up again...

Application.Screenupdating = true
Set target = activecell.offset(0,2)
Do while target.value = ""
target.value = activecell.value
set target = target.offset(-1,0)
Loop
regards
Paul

Bears wrote:

I am trying to write a macro to copy the contents of the cell that the
cursor is in and paste it two columns over into all the cells that are
blank from that row and up until the next cell with something in it. I
just can't get the column offset correct- Help would be appreciated.




All times are GMT +1. The time now is 04:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com