I have a spreadsheet that we use quite often, and am trying to make it a little more "user-friendly". So, to facilitate rapid-resuage, I inserted a Command Button (ActiveX Control), named it "Reset Form, and have this as the code:
Private Sub CommandButton1_Click()
Range("C3").ClearContents
Range("C4").ClearContents
Range("C5").ClearContents
Range("F3").ClearContents
Range("F5").ClearContents
Range("D8").ClearContents
Range("D9").ClearContents
Range("D14").ClearContents
Range("D16").ClearContents
Range("D29").ClearContents
Range("D31").ClearContents
Range("G31").ClearContents
Range("F4") = "=VLOOKUP(F3,Sheet2!A15:C17,3,0)"
Range("D11") = "X:\Development\Database Requests to be Completed\Database Downloads"
End Sub
HOWEVER, "D" cells 14, 16, 29, and 31 are merged with the neighboring "E" cell.
When I run it, I get "Run-Time '1004': We can't do that to a merged cell".
I did several searched through the forums, and found some similar topics, and tried some of the suggested fixes, but couldn't get any to work for me.
Private Sub CommandButton1_Click()
Range("C3").ClearContents
Range("C4").ClearContents
Range("C5").ClearContents
Range("F3").ClearContents
Range("F5").ClearContents
Range("D8").ClearContents
Range("D9").ClearContents
Range("D14").ClearContents
Range("D16").ClearContents
Range("D29").ClearContents
Range("D31").ClearContents
Range("G31").ClearContents
Range("F4") = "=VLOOKUP(F3,Sheet2!A15:C17,3,0)"
Range("D11") = "X:\Development\Database Requests to be Completed\Database Downloads"
End Sub
HOWEVER, "D" cells 14, 16, 29, and 31 are merged with the neighboring "E" cell.
When I run it, I get "Run-Time '1004': We can't do that to a merged cell".
I did several searched through the forums, and found some similar topics, and tried some of the suggested fixes, but couldn't get any to work for me.