Good Morning,
I am running a copy and paste macro (that I recorded). It works when I run it or when I use F8, but when I assign it to a button and use it, Excel stops working and closes. There are several buttons that I use to copy and paste different parts of the worksheet to different worksheets. It appears to "break" after I run one of the other buttons (button 1) There are 3 total buttons that do this, the first two work perfectly while the third button keeps breaking on me. Here is the code for the 3 buttons.
Button 1
Sub CreateComputerClass1()
'
' CreateComputerClass1 Macro
'
'
Sheets("Registration Lists").Select
Range("A4:C28").Select
Selection.Copy
Sheets("Class 1").Select
Range("C5").Select
ActiveSheet.Paste
End Sub
Button 2
Sub CreateComputerClass2()
'
' CreateComputerClass2 Macro
'
'
Sheets("Registration Lists").Select
ActiveWindow.SmallScroll Down:=3
Range("A31:C55").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Class 2").Select
Range("C5").Select
ActiveSheet.Paste
End Sub
Button 3
Sub CreateComputerClass3()
'
' CreateComputerClass3 Macro
'
'
Sheets("Registration Lists").Select
Range("A58:C82").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Class 3").Select
Range("C5").Select
ActiveSheet.Paste
End Sub
I tried adding the line Sheets("Registration Lists").Select to see if that would fix the problem even though it is extra, but it didn't work. Usually what I am doing is creating 3 class lists by clicking on these buttons. When I click on button 3 after creating it, it works. When I click on it after I have clicked on button 1, it breaks. I am a VBA noob, but any help you can offer would be greatly appreciated.
I am running a copy and paste macro (that I recorded). It works when I run it or when I use F8, but when I assign it to a button and use it, Excel stops working and closes. There are several buttons that I use to copy and paste different parts of the worksheet to different worksheets. It appears to "break" after I run one of the other buttons (button 1) There are 3 total buttons that do this, the first two work perfectly while the third button keeps breaking on me. Here is the code for the 3 buttons.
Button 1
Sub CreateComputerClass1()
'
' CreateComputerClass1 Macro
'
'
Sheets("Registration Lists").Select
Range("A4:C28").Select
Selection.Copy
Sheets("Class 1").Select
Range("C5").Select
ActiveSheet.Paste
End Sub
Button 2
Sub CreateComputerClass2()
'
' CreateComputerClass2 Macro
'
'
Sheets("Registration Lists").Select
ActiveWindow.SmallScroll Down:=3
Range("A31:C55").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Class 2").Select
Range("C5").Select
ActiveSheet.Paste
End Sub
Button 3
Sub CreateComputerClass3()
'
' CreateComputerClass3 Macro
'
'
Sheets("Registration Lists").Select
Range("A58:C82").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Class 3").Select
Range("C5").Select
ActiveSheet.Paste
End Sub
I tried adding the line Sheets("Registration Lists").Select to see if that would fix the problem even though it is extra, but it didn't work. Usually what I am doing is creating 3 class lists by clicking on these buttons. When I click on button 3 after creating it, it works. When I click on it after I have clicked on button 1, it breaks. I am a VBA noob, but any help you can offer would be greatly appreciated.