函数学了不少,这个是不是超出了函数范畴
各位大佬,如附件的要求怎么实现好像函数我搞不定,请帮忙,谢谢!
是的,要VBA,只做输入就几句代码。 请指教,谢谢! 我觉得 得用VBA代码解决 得用 VBA代码解决
Private Sub CommandButton1_Click()
i = Sheet2.Range("b65536").End(xlUp).Row + 1
If WorksheetFunction.CountA(Range("c2:c7")) > 0 Then
Sheet2.Cells(i, 2).Resize(1, 6) = WorksheetFunction.Transpose(Range("c2:c7"))
Sheet2.Cells(i, 1) = i - 1
Range("c2:c7").ClearContents
End If
End Sub Sub ruzhang()
Set sht1 = Sheets("Sheet1")
Set sht2 = Sheets("Sheet12")
k = sht2.Cells(Rows.Count, 1).End(xlUp).Row + 1
If k = 2 Then
sht2.Cells(k, 1) = 1
Else
sht2.Cells(k, 1) = sht2.Cells(k - 1, 1) + 1
End If
sht2.Cells(k, 2) = sht1.Range("C2")
sht2.Cells(k, 3) = sht1.Range("C3")
sht2.Cells(k, 4) = sht1.Range("C4")
sht2.Cells(k, 5) = sht1.Range("C5")
sht2.Cells(k, 6) = sht1.Range("C6")
sht2.Cells(k, 7) = sht1.Range("C7")
sht1.Range("C2") = ""
sht1.Range("C3") = ""
sht1.Range("C4") = ""
sht1.Range("C5") = ""
sht1.Range("C6") = ""
sht1.Range("C7") = ""
End Sub Sub 按钮1_Click()
i = Sheet2.Range("B99").End(3).Row + 1
Sheet2.Range("B" & i & ":G" & i) = Application.Transpose(Range("C2:C7"))
Range("C2:C7").ClearContents
End Sub Sub ruzhang()
Set sht1 = Sheets("Sheet1")
Set sht2 = Sheets("Sheet12")
k = sht2.Cells(Rows.Count, 1).End(xlUp).Row + 1
If sht1.Range("C2") = "" Then
MsgBox ("日期不能为空")
Exit Sub
End If
If sht1.Range("C3") = "" Then
MsgBox ("物料名称不能为空")
Exit Sub
End If
If sht1.Range("C4") = "" Then
MsgBox ("数量不能为空")
Exit Sub
End If
If sht1.Range("C5") = "" Then
MsgBox ("规格不能为空")
Exit Sub
End If
If sht1.Range("C6") = "" Then
MsgBox ("类别不能为空")
Exit Sub
End If
If k = 2 Then
sht2.Cells(k, 1) = 1
Else
sht2.Cells(k, 1) = sht2.Cells(k - 1, 1) + 1
End If
sht2.Cells(k, 2) = sht1.Range("C2")
sht2.Cells(k, 3) = sht1.Range("C3")
sht2.Cells(k, 4) = sht1.Range("C4")
sht2.Cells(k, 5) = sht1.Range("C5")
sht2.Cells(k, 6) = sht1.Range("C6")
sht2.Cells(k, 7) = sht1.Range("C7")
sht1.Range("C2") = ""
sht1.Range("C3") = ""
sht1.Range("C4") = ""
sht1.Range("C5") = ""
sht1.Range("C6") = ""
sht1.Range("C7") = ""
End Sub excel里有个记录单了解一下,就是应对这种情况的。
页:
[1]