excel_lelkes
New Member
- Joined
- May 16, 2017
- Messages
- 30
Dear Forum, please help me with the following problem:
I´ve a workbook with two sheets.
I wrote two macros for Sheet2
Both works perfect
my problem is that I can't get them working on Sheet 1
the NOT-working code:
the working code:
I've tried for hours without success
Please help!
Thank in advance
Regards
Peter
I´ve a workbook with two sheets.
I wrote two macros for Sheet2
Both works perfect
my problem is that I can't get them working on Sheet 1
the NOT-working code:
Sub formateraDat()
Dim ws1 As Worksheet, lr As Long, i As Integer
Set ws1 = Sheet1
lr = ws1.Cells(Rows.Count, 1).End(xlUp).Row
MsgBox "lastrow" & " " & lr
For i = 2 To lr
ws1.Cells(i, 1).NumberFormat = ("yy-mm-dd")
Next i
End Sub
the working code:
Sub formateraDatum()
Dim ws2 As Worksheet, lr As Long, i As Integer
Set ws2 = Sheet2
lr = ws2.Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To lr
ws2.Cells(i, 1).NumberFormat = ("yyyy-mm-dd")
Next i
End Sub
I've tried for hours without success
Please help!
Thank in advance
Regards
Peter