• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 487
  • Last Modified:

Excel VBA - copy cell to Dynamic Ragge

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
desmondwkng
Asked:
desmondwkng
  • 4
  • 4
1 Solution
 
Saqib Husain, SyedEngineerCommented:
Activecell.copy range(activecell.offset(0,1),activecell.offset(0,10))
0
 
desmondwkngAuthor Commented:
thanks
0
 
desmondwkngAuthor Commented:
Dear ssaqibh

What if I would like to copy of range of cell, say 7 vertical cell to the next 10 horizontial cell
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
Saqib Husain, SyedEngineerCommented:
Something like

Range(ActiveCell, ActiveCell.Offset(7, 0)).Copy Range(ActiveCell.Offset(0, 1), ActiveCell.Offset(0, 10))
0
 
Saqib Husain, SyedEngineerCommented:
Or simply

ActiveCell.Resize(7, 1).Copy Range(ActiveCell.Offset(0, 1), ActiveCell.Offset(0, 10))
0
 
desmondwkngAuthor Commented:
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
 
Saqib Husain, SyedEngineerCommented:
Try

Selection.Copy Range(ActiveCell.Offset(0, 1), ActiveCell.Offset(0, 10))
0
 
desmondwkngAuthor Commented:
ssaqibh

thanks

desmond
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now