LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #16   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Copy formula automatically down when date is entered

This line adds the formula:

.Offset(0, 1).Formula _
= "=IF(OR(ISBLANK(" & .Address & ")," & .Address _
& "=""NA""),"""",VLOOKUP(" & .Address & "," & _
myLookupRng.Address(external:=True) & ",8,FALSE))"

The OP can change it so that it plops in the formula and then converts it to a
value:

with .Offset(0, 1)
.Formula _
= "=IF(OR(ISBLANK(" & .Address & ")," & .Address _
& "=""NA""),"""",VLOOKUP(" & .Address & "," & _
myLookupRng.Address(external:=True) & ",8,FALSE))"
.value = .value
end with

Dallman Ross wrote:

In , Dave Peterson
spake thusly:

tommylux wrote:
How do I add to this code so that only the value of the formula
is entered into the cell automatically, rather than the formula
itself?


For me (and probably lots of others), the older posts have aged
off and the context of your follow up is lost.


Here you go:

In .com,
tommylux spake thusly:

Thanks dave,

Just what I was looking for, I have changed it a little you may have
confused "NA" for isna which is what the user would type in, forgive
the formatting:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myLookupRng As Range

With Target

If .Cells.Count 1 Then Exit Sub

If Application.Intersect(.Cells, Range("F:F")) Is Nothing
Then
Exit Sub
End If

If Application.Intersect(.Cells, Range("1:1")) Is Nothing Then

If Target.Formula = "" Then
.Offset(0, 1).Formula = ""
Else

Set myLookupRng = Me.Parent.Worksheets("Batch
Links").Range("A:H")

.Offset(0, 1).Formula _
= "=IF(OR(ISBLANK(" & .Address & ")," & .Address &
"=""NA""),"""",VLOOKUP(" & .Address & "," &
myLookupRng.Address(external:=True) & ",8,FALSE))"
End If
End If
End With
End Sub


--

Dave Peterson
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mileage Claim Formula johndavies New Users to Excel 4 August 14th 06 09:24 AM
Trending Formula Results by Date sony654 Excel Worksheet Functions 0 January 2nd 06 02:33 AM
Formula checking multiple worksheets sonic-the-mouse Excel Worksheet Functions 2 June 5th 05 07:48 PM
Formula checking multiple worksheets sonic-the-mouse Excel Worksheet Functions 2 June 5th 05 03:28 AM
Formula to calucate # of months based on a speificed date entered David Excel Worksheet Functions 4 December 15th 04 06:57 PM


All times are GMT +1. The time now is 12:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"