excel macros
Sub CopyIf()
Dim ws1 as Worksheet
Dim ws2 as Worksheet
Set ws1 = Worksheets("Sheet1")
Set ws2 = Worksheets("Sheet2")
If ws1.Range("A1") = ws2.Range("A1") Then
ws1.Range("D1").Copy ws2.Range("D1")
End If
End Sub
Sub CalcAge()
Dim r as Range
On error resume next
Set r = Application.InputBox("Please Select Cell",Type:=8)
if r is nothing then exit sub
r.Offset(,1) = Format(Now() - r,"yy")
--
Charles Chickering
"A good example is twice the value of good advice."
"Marie" wrote:
I need a macro for two different problems. I need one that will copy data
from one spreadsheet to another in such that if a1.sht1 = a1.sht2 then copy
data from d1.sht1 to d1.sht2. I also need one that can calculate an age from
a date so that if c5= 7-Mar-80 then d5= 26. I'm new to macros and am not
sure on how to program this. I'm using Excel 2003.
|