How to copy specific number of rows from cells to cells?

E

Eric

There is a given number in cell U1, which equals to 9, so
I would like to copy 9 cells starting from cell V3, which should copy from
V3 to V11 and paste text only into A3 to A11.

If the given number in cell U1 is 6, then
I would like to copy 6 cells starting from cell V3, which should copy from
V3 to V11 and paste text only into A3 to A8.

Does anyone have any suggestions on how to code this macro in excel 2003?
Thanks in advance for any suggestions
Eric
 
R

Rick Rothstein

When you say "text only"... do you mean cells with numbers should be
formatted as text, or is that your way of saying the cells you are copying
have formulas in them but you only want to copy the values the formulas are
displaying?
 
E

Eric

What if I would like to copy a range V3:Z3,
For example
There is a given number in cell U1, which equals to 9, so
I would like to copy 9 rows starting from cell V3:Z3, which should copy from
V3:Z3 to V11:Z11 and paste text only into A3 to E11.

Does anyone have any suggestions?
Thank you very much for any suggestions
Eric
 
J

Jacob Skaria

Try the below...I hope you meant A3 to B11 and not A3 to E11.

Range("V3").Resize(Range("U1").Value,2).Copy Range("A3")

Also check out help on Resize() and Offset() functions....
 
E

Eric

After I try following code, and see the code display on running macro, but
text disappears after re-calucation, do you have any suggestions on what
wrong it is?
Thanks in advance for any suggestions
Eric
 
J

Jacob Skaria

For values..

Range("V3").Resize(Range("U1").Value, 2).Copy
Range("A3").PasteSpecial xlPasteValues
Application.CutCopyMode = False
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top