Solved

Excel VBA - copy cell to Dynamic Ragge

Posted on 2012-03-18
8
468 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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
 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

860 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