Home |
Search |
Today's Posts |
#13
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Toppers,
You are right. Dave P solved the problem. I'd like to put him on retainer. I'm going to read this group every day. Maybe I'll learn something about VBA. Thanks again for your help Toppers. Zapper "Toppers" wrote in message ... Zapper, See Dave P's solution - does this solve the problem? And it's more elegant than mine! Thanks Dave ... yet another lesson for me. "Zapper" wrote: Topper, The sub is working like a charm on all but the last range (rangeT). It's fast too. It's hanging on the following line: target.Copy target.Offset(1, 0).Resize(lr - target.Row) I won't ask you to work on Sunday, I can wait. Regards, Zapper "Toppers" wrote in message ... Zapper, Try these changes which now COPY the cells and hence formula. Sub FILL() ' FILL Macro ' Macro recorded 1/19/2006 by Zapper ' ' Keyboard Short cut: Ctrl+y ' Dim target As Range, rng As Range Set target = ActiveCell ValidRng = Array("rangeA", "rangeW", "rangeF", "rangeV", "rangeT") For i = 0 To 4 Set rng = Range(ValidRng(i)) If Not Intersect(target, rng) Is Nothing Then lr = CInt(Right(rng.Address, 2)) ' Last row in rng target.Copy target.Offset(1, 0).Resize(lr - target.Row) Cells(target.Row, target.Column).Select Exit Sub End If Next i End Sub "Zapper" wrote: I need some help with this problem. I have four ranges in the same worksheet. For example: rangeA (d5:d15) rangeB (d20:d33) rangeC (d40:d67) rangeD (d74:d82) I defined four names: rangeAend (d15) rangeBend (d33) rangeCend (d67) rangeDend (d82) I want to be able to invoke a macro (Ctrl+letter) from any cell within any of the four ranges. The first thing I want to do is make sure the cell is in column D and within one of the four ranges. Then I want to FILL from that cell to the end of the range the cell is in. And then move to one cell below the end of the range. I'd appreciate any and all help. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copying and pasting from a range | Excel Worksheet Functions | |||
Pasting Values of range to another range | Excel Programming | |||
Pasting date in a range | Excel Programming | |||
Pasting an array into a range | Excel Programming | |||
Help - Selecting and pasting into range | Excel Programming |