Hi all.
So far I have this code, to copy the value from sheet1 B4 to sheet2 A17 and Sheet3 A17.
Sub Wagenpflege()
Dim Dat1 As Range
Dim Dat2 As Range
Dim Dat3 As Range
Set Dat1 = Worksheets("sheet1").Range("B4")
Set Dat2 = Worksheets("sheet2").Range("A17")
Set Dat3 = Worksheets("sheet3").Range("A17")
Dat1.Copy
Dat2.PasteSpecial
Dat3.PasteSpecial
Dat1.Delete
End Sub
Now I wanna make sure, that when I put a new value into sheet1 b4, it pastes the values into the next empty celly in column A of sheet 2 and 3.
I tried the following with help from google (first only for pasting into sheet2, so that it won't become too complicated for a start)
Sub Wagenpflege()
Dim Dat1 As Range
Dim Dat2 As Range
'Dim Dat3 As Range
Set Dat1 = Worksheets("sheet1").Range("B4")
Set Dat2 = Worksheets("sheet2").Range("A17")
'Set Dat3 = Worksheets("sheet3").Range("A17")
If Dat2.Value = Empty Then
Dat1.Copy
Dat2.PasteSpecial
'Dat3.PasteSpecial
Dat1.Delete
Else
Dat1.Copy
Sheets("sheet2").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Paste
End If
End Sub
I do however get a "object doesn't support this property or method"-error, once sheet2 A17 has a value in it.
Can you guys help me?
Bookmarks