Solved

Excel VBA - copy cell to Dynamic Ragge

Posted on 2012-03-18
8
465 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

743 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