assume the date to find is in D21
and in column A of the blowdown log
Dim rng as Range
Dim res as Variant
With worksheets("BlowDown Log")
set rng = .Range(.cells(1,1),.cells(1,1).End(xldown))
End with
res = Application.Match(clng(Range("D21")),rng,0)
if not iserror(rng) then
Range("F23").copy
rng(res).offset(0,5).Pastespecial xlValues
else
rng.offset(rng.rows.count,0).Resize(1,1).Value = Range("D21")
rng.offset(rng.rows.count,0).Resize(1,1).offset(0, 5).PasteSpecial xlValues
end if
--
Regards,
Tom Ogilvy
"sowetoddid " wrote in message
...
This is the code that I am try to work with...
Sub BlowdownVolume()
Range("D22").Select
ActiveCell.FormulaR1C1 = _
"=1.96*(R[-16]C[1]+14.7)*(R[-4]C[-2]^2)*R[-15]C[-2]*1000/(R[-3]C[-2]*10^6)"
Range("F23").Select
Selection.NumberFormat = "#,##0"
Selection.Copy
Sheets("Blowdown Log").Select
Range("F5").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Range("F5").Select
End Sub
The code above is taking the user inputs and calculating one of the
outputs by pasting the formula into the specified cell. The results
are then pasted into the appropriate cell on the Blowdowns sheet. This
basic operation will be repeated for each of the ouput calculations.
The first operation should be to compare the inputted date on sheet1
with the previously pasted dates on the "blowdown log". If the current
input is already listed, then it writes over it with the most recent
outputs. If the date is not shown on "blowdown log", then the most
recent outputs should be pasted on the first available row on the
"Blowdown log".
---
Message posted from http://www.ExcelForum.com/