LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Pasting in a range

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying and pasting from a range John Excel Worksheet Functions 3 June 6th 07 05:22 PM
Pasting Values of range to another range STEVE BELL Excel Programming 5 October 11th 05 12:10 AM
Pasting date in a range SIGE Excel Programming 0 September 15th 05 01:04 PM
Pasting an array into a range Tony Excel Programming 4 January 7th 05 12:24 AM
Help - Selecting and pasting into range amonymous Excel Programming 4 January 21st 04 12:21 AM


All times are GMT +1. The time now is 01:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"