当我将格式从模板粘贴到另一个包含从已关闭的书中导入的值和文本的工作表时,出现了一个问题。
似乎没有明显的原因,模板图纸编号格式从定制更改为日期。任何帮助,将不胜感激。谢谢
Dim WS As Worksheet
Set WS = ThisWorkbook.Worksheets.Add(After:=ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Count), Type:=xlWorksheet)
WS.Name = TextBox1.Value
Set WshNew = ThisWorkbook.Worksheets("Template_NewDCF")
Set WshOld = ThisWorkbook.Worksheets("Template_OldDCF")
Set wb = ActiveWorkbook
GetData NameTextBox.Value, "DCF", "A1:DD67", Sheets(TextBox1.Value).Range("A1:DD67"), False, False
If ComboBox1 = "Old Template" Then
WshOld.Cells.Copy
With WS.Cells
.PasteSpecial Paste:=xlPasteFormats 'Source format is pasted.
.PasteSpecial Paste:=xlPasteComments 'Comments are pasted.
.PasteSpecial Paste:=xlPasteValidation 'Validations are pasted.
Application.CutCopyMode = False
Application.GoTo .Cells(1), 1
ActiveWindow.DisplayGridlines = False
WS.Cells(2, 15) = WshNew.Cells(2, 2)
End With