Pasting in a range
Toppers,
Topper, Thanks for the help.
Sorry about that first message.
Here's what I'm working with -- a checkbook file.
-------------------------------------------------------------------------------------------------
A B C D E
F
Trans Date Description Payment Deposit Balance
2006 1/1 Beginning balance
1,163.17
EP 1/2 Cable TV 31.00
1,132.17 2--then this becomes the target cell for pasting down
EP 1/3 AT&T Visa 103.44
1,028.73 1<if I delete this line, it screws up the balance
INT 1/10 AmSouth Interest 0.27 1,029.00
to the end of the range
720 1/11 MACYS Visa 42.60 986.40
EP 1/15 Cingular Cellphone 46.21 940.19
EP 1/15 Brighthouse Cable 44.95 895.24
-------------------------------------------------------------------------------------------------
I have 5 not 4 of these ranges.
The above example is the same for all ranges.
//////////////////////////////////////////////////////////////
The sub is getting there!
If the target cell is not in col F, return from the sub. <<<<< This
works!!!
The sub is pasting in the correct range but not the correct data.
Also, it pastes very slow.
The sub is pasting the value in the cell rather than the (add or subtract)
formula.It's pasting the value, e.g., "1,028.73" all the way down.
I tried to paste the cell formula.
I changed value to formula and it pastes the same formula from the first
cell
in the remaining cells in therange.
I need it to increment by one all the way down, even for an inserted line.
=IF(D50,F4-D5,F4+E5) < if this is the first cell, it pastes D5 etc all
theway down
=IF(D60,F5-D6,F5+E6) it needs to increment by one
=IF(D70,F6-D7,F6+E7)
---------------------------------------------------------------------------------------
Here's the sub.
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 = Right(rng.Address, 2) ' Last row in rng
For j = target.Row To lr
Cells(j, target.Column) = target.Formula
Next j
Cells(j, target.Column).Select
Exit Sub
End If
Next i
End Sub
If you can get this sub to paste the correct data (formula) in the cells
the job is complete.
Thanks again for your help.
|