Excel 2003 - "IF" function and attach file
This file I prepare specially to show what I am looking for.
The parameters in this file are different then one describe in my first post "Excel 2003 - "IF" function", but
the problem is the same.
Attachment | Size |
---|---|
IF Test.xls | 39.5 KB |
The dates in column A are all
Paste the following code into the sheet1 module. Set the date in cell J4 of sheet1 and double click on it.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Column <> 10 Then Exit Sub
If Target.Row <> 4 Then Exit Sub
XfrData
End Sub
Sub XfrData()
Dim Y As Integer, X As Integer, XfrFlag As Boolean
XfrFlag = False
For Y = 4 To 105
If Sheet1.Range("A" & Y).Value = Sheet1.Range("J4").Value Then
For X = 11 To 16
Sheet1.Cells(Y, X - 9).Value = Sheet1.Cells(4, X).Value
XfrFlag = True
Next X
If XfrFlag = True Then Exit For
End If
Next Y
If XfrFlag = False Then
MsgBox "A matching date was not found"
End If
End Sub
If function
Thankyou for your help.
Everything works perfect.