Solved

Excel VBA - copy cell to Dynamic Ragge

Posted on 2012-03-18
8
466 Views
Last Modified: 2012-03-25
Hi Experts,

I would like to copy the current cell (highted range) to the cells next (next 10 cell on the right) to it.

Now I'm doing it on an uneffective way :

Set CurrCell = ActiveCell
    Application.ScreenUpdating = False
    Selection.Copy
    ActiveCell.Offset(0, 1).Select
    ActiveSheet.Paste
    ActiveCell.Offset(0, 1).Select
    ActiveSheet.Paste
    ActiveCell.Offset(0, 1).Select
    ActiveSheet.Paste
    ActiveCell.Offset(0, 1).Select
    ActiveSheet.Paste
    ActiveCell.Offset(0, 1).Select
    ActiveSheet.Paste
    ActiveCell.Offset(0, 1).Select
    ActiveSheet.Paste
    ActiveCell.Offset(0, 1).Select
    ActiveSheet.Paste
    ActiveCell.Offset(0, 1).Select
    ActiveSheet.Paste
    ActiveCell.Offset(0, 1).Select
    ActiveSheet.Paste
    ActiveCell.Offset(0, 1).Select
    ActiveSheet.Paste

Can you help me to make it more simple

thanks
0
Comment
Question by:desmondwkng
  • 4
  • 4
8 Comments
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 250 total points
ID: 37736220
Activecell.copy range(activecell.offset(0,1),activecell.offset(0,10))
0
 

Author Closing Comment

by:desmondwkng
ID: 37736449
thanks
0
 

Author Comment

by:desmondwkng
ID: 37740115
Dear ssaqibh

What if I would like to copy of range of cell, say 7 vertical cell to the next 10 horizontial cell
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37741040
Something like

Range(ActiveCell, ActiveCell.Offset(7, 0)).Copy Range(ActiveCell.Offset(0, 1), ActiveCell.Offset(0, 10))
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37741041
Or simply

ActiveCell.Resize(7, 1).Copy Range(ActiveCell.Offset(0, 1), ActiveCell.Offset(0, 10))
0
 

Author Comment

by:desmondwkng
ID: 37746306
ssaqibh

in my orignial marco, I can hightligt the copy area(variable range also) by using the cursor, then I can use the marco to copy across the row. But here I have to define the ActiveCell Size(or range) first.  
Is there a way that I can use the cursor to highlight the range and copy across

thanks
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37749212
Try

Selection.Copy Range(ActiveCell.Offset(0, 1), ActiveCell.Offset(0, 10))
0
 

Author Comment

by:desmondwkng
ID: 37764277
ssaqibh

thanks

desmond
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sql server query from excel 3 57
In search of x17-22375.exe 2 12
TSQL DateADD update Question 4 27
Excel printing page management 2 19
This article will show you how to use shortcut menus in the Access run-time environment.
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

914 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now