我正在使用宏将用户粘贴的数据移动到同一工作簿中另一个工作表中的相应列中。这是通过使用标准.select和.paste
的宏来完成的然而,在粘贴日期信息的地方[无论我使用粘贴值还是标准粘贴],依赖于粘贴的开始日期和结束日期的Networkdays
公式在我选择进入单元格并点击之前不会更新' Enter
'
计算已启用,刷新数据不起作用,强制计算不起作用,日期已通过TRIM
并在复制前重新粘贴为值。在我选择并点击“输入”之前,它根本不会计算开始日期和结束日期。双方。存在NETWORKDAYS
公式的单元格与粘贴数据位于同一工作表中。
=IF($E3=0,0,(MAX(0,NETWORKDAYS(MAX(H$2,$E3),MIN(DATE(YEAR(H$2),MONTH(H$2)+1,0),$F3),UK))))
E3 is my start date - formatted as Date
H2 is my month - formatted as Date
F3 is my End date - formatted as Date
当文本输入到开始日期和结束日期时,这非常合适。
这里有史以来第一个问题 - 感谢迄今为止数以百万计的解决方案。
Range("C9:C10").Select
Selection.Copy
Range("D9").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.NumberFormat = "m/d/yyyy"
Range("C3").Select
Selection.Copy
Sheets("Contractors - UK").Select
Range("B3").End(xlDown).Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Input Contractor").Select
Range("C4").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Contractors - UK").Select
Range("C3").End(xlDown).Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Input Contractor").Select
Range("C5").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Contractors - UK").Select
Range("D3").End(xlDown).Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Input Contractor").Select
Range("D9").Select
Selection.Copy
Sheets("Contractors - UK").Select
Range("E3").End(xlDown).Offset(1, 0).Select
ActiveSheet.Paste
Sheets("Input Contractor").Select
Range("D10").Select
Selection.Copy
Sheets("Contractors - UK").Select
Range("F3").End(xlDown).Offset(1, 0).Select
ActiveSheet.Paste
Range("F3").Select
Selection.End(xlDown).Select
Selection.Copy
ActiveSheet.Paste
Sheets("Input Contractor").Select
Range("C21").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Contractors - UK").Select
Range("G3").End(xlDown).Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("G3").Select
Selection.End(xlDown).Select
Selection.Copy
ActiveSheet.Paste
Sheets("Input Contractor").Select
Range("A1:A23").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("D9:D10").Select
Application.CutCopyMode = False
Selection.ClearContents
Sheets("Contractors - UK").Select
Range("B3").Select
Selection.End(xlDown).Select
End Sub