ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Range selection (https://www.excelbanter.com/excel-discussion-misc-queries/161408-range-selection.html)

Naveen

Range selection
 
I need help to write a formula for the following ;

Say I have some value in A1, and I want it to copy to number of cells, given
in A2, in the same row starting from A3.
A1="xxx", A2=2, A3,A4="xxx"
Thanks for immediate help.

Gary''s Student

Range selection
 
Sub naveen()
Set r1 = Range("A1")
Set r2 = Range("A3:A" & 2 + Range("A2").Value)
r1.Copy r2
End Sub

--
Gary''s Student - gsnu200749


"Naveen" wrote:

I need help to write a formula for the following ;

Say I have some value in A1, and I want it to copy to number of cells, given
in A2, in the same row starting from A3.
A1="xxx", A2=2, A3,A4="xxx"
Thanks for immediate help.


Naveen

Range selection
 
Thanks for immediate response. Can we do it without macros meaning with
formulas in the range.

"Gary''s Student" wrote:

Sub naveen()
Set r1 = Range("A1")
Set r2 = Range("A3:A" & 2 + Range("A2").Value)
r1.Copy r2
End Sub

--
Gary''s Student - gsnu200749


"Naveen" wrote:

I need help to write a formula for the following ;

Say I have some value in A1, and I want it to copy to number of cells, given
in A2, in the same row starting from A3.
A1="xxx", A2=2, A3,A4="xxx"
Thanks for immediate help.


Gary''s Student

Range selection
 
In A3 enter:

=IF(ROWS($A$1:A1)-1<$A$2,$A$1,"") and copy down

This is not a "true" copy, but it does the job
--
Gary''s Student - gsnu200749


"Naveen" wrote:

Thanks for immediate response. Can we do it without macros meaning with
formulas in the range.

"Gary''s Student" wrote:

Sub naveen()
Set r1 = Range("A1")
Set r2 = Range("A3:A" & 2 + Range("A2").Value)
r1.Copy r2
End Sub

--
Gary''s Student - gsnu200749


"Naveen" wrote:

I need help to write a formula for the following ;

Say I have some value in A1, and I want it to copy to number of cells, given
in A2, in the same row starting from A3.
A1="xxx", A2=2, A3,A4="xxx"
Thanks for immediate help.



All times are GMT +1. The time now is 02:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com