Solved

VBA Excel - Copy a cell range to next blank range

Posted on 2013-01-19
3
594 Views
Last Modified: 2013-01-20
Hi,

I am working on "Sheet4".

I need to cut cells from "FQ3:FQ63" (including formulas and formatting) and paste to the next blank column in the range "B3:FP63".

Can anyone help craft the macro code to do this?

Thankyou
0
Comment
Question by:mhdi
  • 2
3 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 38797815
Do you want to cut-paste or copy-paste?

for cut-paste try

sheets("sheet4").range("FQ3:FQ63").move sheets("sheet4").range("FP4").end(xltoleft).offset(,1)

for copy-paste

sheets("sheet4").range("FQ3:FQ63").copy sheets("sheet4").range("FP4").end(xltoleft).offset(,1)
0
 

Author Comment

by:mhdi
ID: 38797823
Im getting this error: "object does not support this property or method"

This looks much better then my ForNext solution that I was attempting :)

Edit: I want to cut and paste (move)
0
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
ID: 38797840
Sorry it should have been cut instead of move

Sheets("sheet4").Range("FQ3:FQ63").Cut Sheets("sheet4").Range("FP3").End(xlToLeft).Offset(, 1)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question