Run a macro that applies to any selected row

G

Greg Crain

I want to be able to start a macro and have it do some copy/past
functions on the cells in the specific row that I am in when the macr
is started. In other words, lets say I move down Col A and stop in ro
A23, I want the macro to do some copy/paste in that specific row. If
decided to stop in A45, I want to do the same copy/paste functions i
the same columns relative to the selected row. Can I do this with
single macro?

I'm still learning..but who isn't. Thanks in advance...Gre
 
D

Don Guillett

The keyword here is activecell. You didn't say if the activecell was the
source or destination?
 
G

Greg Crain

The active cell would always be in Column A and would be the source if
understand correctly. To further explain, I went to A84 and recorde
the macro I wanted. The macro copied & pasted data frm cells C84, F8
and S84 into specific cells in another workbook as an example. It di
exactly as I wanted. Then I scrolled up to another cell in column A
Lets say it was A16. When I run the macro, I would want to copy C16
F16, and S16 into the same (absolute) cells in the other workbook a
before. However, when I run the macro when A16 is the acitve cell, th
macro copies and pastes from C84, F84 and S84. Basically what I a
wanting to do is copy and then paste information found in the same ro
as the active cell with one macro. If it helps, the macro describe
above starts with the following: Range("C84").Select . I have jus
never tried to do this before and need a little help. Any tips woul
help. Sorry to sound like such a newbie.

Thanks again
Gre
 
D

Don Guillett

OK , then try which will put c in c, f in f and s in s, overwriting any
intervening cells on a13 on sheet 2. Is that what you want?

Sub copysome()
x = ActiveCell.Row
Range("c" & x & ":f" & x & ":s" & x).Copy _
Worksheets("sheet2").Range("a13")
End Sub
 
G

Greg Crain

Don,
Thanks for the effort. I guess I'm just not knowledgeable enough in VBA
and the syntax required to pull this off. The only way that I am able
to create a macro is simply to start recording and then go through the
actions. I think that you caught the basic idea of what I need to do
though. Thanks again....guess I will just have to keep plugging along
with my trial & error method as I learn macros better.......Greg
 
G

Greg Crain

Don,
Dropped you a file. Thanks for the offer. Any help is greatly
appreciated!!
 

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

Top