copy range and paste into every 3rd cell of new range

T

thomsonpa

I have 2 worksheets and I am looking for a macro that will copy a range of
cells from one worksheet, then paste them to another worksheet, but leave 2
blank cells between each cell.

sheet to copy from "MON" range: A7:A80
sheet to paste into "MON LOG" starting at cell A5, paste then leave 2 cells
blank, next cell A8, etc. until all of the copied range A7:A80 has been
pasted.

Any ideas?
 
B

Bernard Liengme

This seems to work - not test extensively

Sub CopyJump()
myrange = Range("MON!A7:A80")
j = 5
For Each mycell In myrange
Worksheets("MON LOG").Cells(j, 1).Value = mycell
j = j + 3
Next
End Sub

bets wishes
 
T

thomsonpa

Sorry I cannot get this to work, I need to insert it inot visual basic in the
middle of my code (inside a sub), I tried deleting the sub and end sub from
your code, but get error 1004. I have selected the range on "MON" sheet and
named it myrange, is this correct? Sorry i am a beginner and need more exact
instructions.

Many thanks for your prompt response.

Peter.
 
T

thomsonpa

Well I have got this to work a treat now, many thanks. I used the call
method to run the macro when I wanted it to run.

Mnay thanks.
 
B

Bernard Liengme

Thanks for the feedback.
For future reference: when you see RANGE("myrange") the code is referring to
a named range on the worksheet but Myrange on its own is a VBA variable like
j in my code.
best wishes
 

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