心情永恒 发表于 2021-9-18 14:37:00

函数学了不少,这个是不是超出了函数范畴

各位大佬,如附件的要求怎么实现
好像函数我搞不定,请帮忙,谢谢!

吃肉的兔子 发表于 2021-10-25 04:40:42

是的,要VBA,只做输入就几句代码。

歇会儿 发表于 2021-10-29 23:06:39

请指教,谢谢!

凡事想开烦恼必少 发表于 2021-11-13 05:55:28

我觉得 得用VBA代码解决

铌克 发表于 2021-11-26 09:30:28

得用 VBA代码解决

语晨 发表于 2021-12-1 06:18:18

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

校长就是校长 发表于 2021-12-6 09:56:57

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

大班生 发表于 2021-12-7 03:01:56

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

磁悬浮 发表于 2021-12-12 17:29:25

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

马大师 发表于 2021-12-14 21:58:19

excel里有个记录单了解一下,就是应对这种情况的。
页: [1]
查看完整版本: 函数学了不少,这个是不是超出了函数范畴