简体   繁体   English

VBA 表单返回 WEEKNUM

[英]VBA Form Returning the WEEKNUM

I am trying to use a VBA user form to show the week number on the data sheet.我正在尝试使用 VBA 用户表单在数据表上显示周数。

So for example.举个例子。 when the form is submitted it creates the date of when the button is pressed.提交表单时,它会创建按下按钮的日期。 I need that to also show the week number against that date when the button is pressed.我还需要在按下按钮时显示该日期的周数。

I have tried a similar call function when using date and changed to weeknumber and i have checked online but I am struggling to find the answer.我在使用日期并更改为周数时尝试了类似的调用 function 并且我已经在网上检查过,但我很难找到答案。

Dim emptyRow As Long, ws As Worksheet

Set ws = Sheets("Ethan")
emptyRow = ws.Range("A" & Rows.Count).End(xlUp).Row + 1


ws.Range("A" & emptyRow).Value = Date
ws.Range("A" & emptyRow).Value = WeekNum (this doesn't work)

ws.Range("A" & emptyRow).Value = WorksheetFunction.WeekNum(Date, vbMonday)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM