View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_7_] Bob Phillips[_7_] is offline
external usenet poster
 
Posts: 1,120
Default Help with macros

Here is some code

Dim sDate As String
sDate = Format(DateSerial(Year(Date), Month(Date), 0), "mm-yyyy")
Range("I1").Formula = "=LOOKUP(B2," & sDate & "!B:B,'" & sDate &
"'!J:J)"
Range("I1").AutoFill Range("I1").Resize(Cells(Rows.Count,
"A").End(xlUp).Row)


--
HTH

Bob Phillips

"Marina" wrote in message
...
Forgive me if this posting is in the wrong area of this forum. I would

like
to create a macro that inserts a formula into each cell in column I where

the
column A is populated for that row.

The formula I'd like to use is: =LOOKUP(B2,'06-2005'!B:B,'06-2005'!J:J)

I want the formula to reflect the previous worksheet (month-1) rather than

a
fixed name ('06-2005') putting in a fixed sheet name.

Is this possible? If so, how?

Thanks in advance,
Marina Garrison