View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Toppers Toppers is offline
external usenet poster
 
Posts: 4,339
Default Pasting in a range

Zapper,

Hope this gets you started. I FILL the cells with X ...
wasn't sure what you wanted as FILLing!

Sub rngFill()
Dim target As Range, rng As Range
Set target = ActiveCell
ValidRng = Array("rangeA", "rangeB", "rangeC", "RangeD")
For i = 0 To 3
Set rng = Range(ValidRng(i))
If Not Intersect(target, rng) Is Nothing Then
lr = Right(rng.Address, 2) ' Last row in rng
For j = target.Row To lr
Cells(j, target.Column) = "x"
Next j
Cells(j, 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.