michaelm0162
New Member
- Joined
- Oct 21, 2020
- Messages
- 7
- Office Version
- 365
- Platform
- Windows
I am the definition of a VBA beginner. I only google codes and try to manipulate them to do what i need but i could not find to do this exactly to manipulate.
I have a form where its a check in/check out for our company for parts.
The first If statement works perfectly
on the "FORM" tab i have this off the side
When R3 = anything other than 1 (hence the else)
I want it to look up the "Tool Number", "M5" in "Form", in the "ToolsInToolRoom" sheet and delete that row (IF IT IS NOT ON THE LIST THEN CONTINUE)
Then i want it to take "L5:O5" and paste it into "CheckOutHistory"
I have the following code based on a button:
Sub Button10_Click()
If Worksheets("Form").Range("R3").Value = 1 Then
Sheets("Form").Range("L5:O5").Copy
Sheets("ToolsInToolRoom").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial (xlPasteValues)
Sheets("Form").Range("D5:D8").ClearContents
Sheets("Form").Range("C16:I21").ClearContents
MsgBox "Check in complete."
Else
Sheets("Form").Range("L5:O5").Copy
Sheets("CheckOutHistory").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial (xlPasteValues)
*****NEED HELP HERE*****
Sheets("Form").Range("D5:D8").ClearContents
Sheets("Form").Range("C16:I21").ClearContents
MsgBox "Check out complete."
End If
End Sub
I have a form where its a check in/check out for our company for parts.
The first If statement works perfectly
on the "FORM" tab i have this off the side
When R3 = anything other than 1 (hence the else)
I want it to look up the "Tool Number", "M5" in "Form", in the "ToolsInToolRoom" sheet and delete that row (IF IT IS NOT ON THE LIST THEN CONTINUE)
Then i want it to take "L5:O5" and paste it into "CheckOutHistory"
I have the following code based on a button:
Sub Button10_Click()
If Worksheets("Form").Range("R3").Value = 1 Then
Sheets("Form").Range("L5:O5").Copy
Sheets("ToolsInToolRoom").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial (xlPasteValues)
Sheets("Form").Range("D5:D8").ClearContents
Sheets("Form").Range("C16:I21").ClearContents
MsgBox "Check in complete."
Else
Sheets("Form").Range("L5:O5").Copy
Sheets("CheckOutHistory").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial (xlPasteValues)
*****NEED HELP HERE*****
Sheets("Form").Range("D5:D8").ClearContents
Sheets("Form").Range("C16:I21").ClearContents
MsgBox "Check out complete."
End If
End Sub