品質チェックシートを設定して、結果をデータの行として「データ」という別のシートに保存し、チェックシートのアーカイブバージョンを別のワークブック。 私はVBAの初心者ですが、私は仕事が必要なものを手に入れました。チェックシートに含まれているボタンにマクロを割り当てると、私の問題が発生します。私はボタンを押すと、間違ったシートをコピーし、マクロを手動で実行するときには基本的には何もしません。誰でも何か提案してもらえますか?ボタンに割り当てられたときのVBAの動作が異なります
おかげ
私のコードは次のとおりです。
Sub SaveForm()
' SaveForm Macro
' Saves form data to the Data Sheet
'Checks for completion of mandatory fields
If IsEmpty(Range("b3").Value) = True Then
MsgBox "Please complete 'Agent Name' before saving"
Exit Sub
ElseIf IsEmpty(Range("b4").Value) = True Then
MsgBox "Please complete 'Call ID' before saving"
Exit Sub
ElseIf IsEmpty(Range("b5").Value) = True Then
MsgBox "Please complete 'Call Length' before saving"
Exit Sub
ElseIf IsEmpty(Range("D3").Value) = True Then
MsgBox "Please complete 'Business Name' before saving"
Exit Sub
ElseIf IsEmpty(Range("D4").Value) = True Then
MsgBox "Please complete 'Date of Call' before saving"
Exit Sub
ElseIf IsEmpty(Range("D5").Value) = True Then
MsgBox "Please complete 'Time of Call' before saving"
Exit Sub
ElseIf IsEmpty(Range("b7").Value) = True Then
MsgBox "Please complete 'Assessor Name' before saving"
Exit Sub
ElseIf IsEmpty(Range("b8").Value) = True Then
MsgBox "Please complete 'Date of Assessment' before saving"
Exit Sub
End If
'Copies a range contained within the "Checksheet" and pastes
'it into the next available row on the "Data" sheet
'The reason it is in a straight row as opposed to sporadic cell
'references is because I have set the sheet up this way for simplicity
Range("M14:BP14").Copy
Sheets("Data").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
ActiveWindow.ScrollRow = 1
Workbooks("Call Feedback Form V0.42.xlsm").Sheets("Checksheet").Activate
Call CopyRenameWorksheet
Workbooks("Call Feedback Form V0.42.xlsm").Sheets("Checksheet").Activate
End Sub
。
Sub CopyRenameWorksheet()
'This renames the worksheet based on cell references and archives to another workbook
Dim ws As Worksheet
Set wh = Worksheets(ActiveSheet.Name)
ActiveSheet.Copy After:=Worksheets(Sheets.Count)
If wh.Range("B3").Value <> "" Then
ActiveSheet.Name = wh.Range("B3").Value & " " & Format(wh.Range("D4").Value, ("yymmdd")) & " " & wh.Range("B4").Value
ActiveSheet.Move After:=Workbooks(_
"Archived Quality Forms.xlsx").Sheets(1)
End If
コードの一部が正しく書式設定されていない(灰色のボックスではありません)が、どのようにするべきかわかりません。また、[MCVE](https://stackoverflow.com/help/mcve)を提供してください。 – Marein
こんにちは。申し訳ありません、私は全く新しいです。 – RWGFloyd
私は灰色のボックスでそれをすべて取得する方法がわかりません、サイトはこのように書式設定しました。それを調整する方法はありますか? – RWGFloyd