Hi,
I build a script in macro:
Function DateAndTime(RowToRead as string)
Sheet1.Range(“C”+RowToRead).Value = date.Now.ToString
End Function
What is the problem?
Hi,
I build a script in macro:
Function DateAndTime(RowToRead as string)
Sheet1.Range(“C”+RowToRead).Value = date.Now.ToString
End Function
What is the problem?
Hi @Lior_Shamir
The issue is that if you want sheet1 then you have to either use
Sheets("Sheet1")
or
Worksheets("Sheet1")
but not sheet1 directly
cheers
Thanks @Anil_G
So, it would be something like this:
Function DateAndTime(RowToRead as string)
Sheets(“Sheet1”).Range(“C”+RowToRead).Value = date.Now.ToString
End Function
If it works, kindly mark Anil’s post as solution to close the topic
Thanks!
The problem was the date.Now.ToString
So, the correct way is:
Function DateAndTime(RowToRead as string)
Sheet1.Range(“F”+RowToRead).Value = Now
End Function
Thanks
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.