Ashkan2016
New Member
- Joined
- May 8, 2016
- Messages
- 5
Hi all
I am trying to write for my excel .I am begginer and this first time I tred Macro.
I wrote this code
<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit;">
error 1004;Select method of rang class failed and the line
Worksheets("2").Range("C26:D27").Select
is highlighted
I have no idea what to do ;can you guys help me thanks
Ashkan
Email:rezania.ashkan@gmail.com
</code>
I am trying to write for my excel .I am begginer and this first time I tred Macro.
I wrote this code
<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit;">
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Application.Worksheets("1").Range("D2").Value = "Completed" Then
Worksheets("2").Range("C26").Value = Date
Else
Worksheets("2").Range("C26").Value = ""
End If
If Application.Worksheets("1").Range("E2").Value = "Completed" Then
Worksheets("2").Range("D26").Value = Date
Else
Worksheets("2").Range("D26").Value = ""
End If
If Application.Worksheets("1").Range("D3").Value = "Completed" Then
Worksheets("2").Range("C27").Value = Date
Else
Worksheets("2").Range("C27").Value = ""
End If
If Application.Worksheets("1").Range("E3").Value = "Completed" Then
Worksheets("2").Range("D27").Value = Date
Else
Worksheets("2").Range("D27").Value = ""
End If
Worksheets("2").Range("C26:D27").Select
Selection.autofill Destination:=Worksheets("2").Range("C26:ZZ52")
End Sub
error 1004;Select method of rang class failed and the line
Worksheets("2").Range("C26:D27").Select
is highlighted
I have no idea what to do ;can you guys help me thanks
Ashkan
Email:rezania.ashkan@gmail.com
</code>