![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Los Angeles, CA
Posts: 752
|
I have a formula in Column R Row 2 that I want to have scrolled down till the end of column B.
Ex. Col.B ends at row 200, I want the macro to click and drag the formula till row 200. I can't figure it out? Any suggestions, Thanks |
|
|
|
|
|
#2 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
You want r2:b200 filled, 'cause that is:
Code:
Sub cpier() [r2].Copy [b2:r200] End Sub _________________ Cheers, NateO [ This Message was edited by: NateO on 2002-04-26 16:20 ] |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Huntington Beach, CA USA
Posts: 327
|
I'm not clear on what you need? Do you want
the formula that resides in R2 copied from B2:B200? James |
|
|
|
|
|
#4 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
If it's b2:b200 then:
Code:
Sub cpier() [r2].Copy [b2:b200] End Sub |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Feb 2002
Location: Los Angeles, CA
Posts: 752
|
Yes, what I need is the formula in R2 to be clicked and dragged. But to stop at the same row column B ends. Thanks
|
|
|
|
|
|
#6 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Range("R2:R200").FillDown
???????? |
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Feb 2002
Location: Los Angeles, CA
Posts: 752
|
The thing is the range changes. Depending on the number of rows in column B. So it could be 5, 100 or 15000.
|
|
|
|
|
|
#8 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
Hi,
If column B is variable in length, then try, Sub test() Dim lastrow As Long lastrow = Cells(Rows.Count, 2).End(xlUp).Row Range("R2").Copy Range("R3:R" & lastrow) End Sub Also, to prevent the formula in cell R2 from accidentally being deleted, load that at run time as well. Range("R2:R" & lastrow) = "=10*ROW()" for example. Bye, Jay |
|
|
|
|
|
#9 |
|
Board Regular
Join Date: Feb 2002
Location: Los Angeles, CA
Posts: 752
|
YES!!!!! Now I can go and have a beer. Jay if you were around I would get you one. Thanks, that did the job and I am done for the week.
Parra |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|