CoogansBluff
Board Regular
- Joined
- Mar 7, 2021
- Messages
- 59
- Office Version
- 2013
- Platform
- Windows
I've created a sports game on Excel. It loads lineups with a macro, and the macro plays a little tune (wave file) at the end when a lineup is loaded.
The wave file plays in some, but not others. Trying to figure out how they are different.
It plays it this one:
Sub AwayAlabama2012()
'
' AwayAlabama2012 Macro
'
'
Sheets("Lineups").Select
Range("D1415:T1427").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Master").Select
Range("B4").Select
ActiveSheet.Paste
Sheets("Lineups").Select
Range("D1429:T1441").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Master").Select
Range("B32").Select
ActiveSheet.Paste
Range("Q4").Select
Application.CutCopyMode = False
Selection.Copy
Range("U2").Select
ActiveSheet.Paste
PlaySound "D:\Smith's Data\Desktop\WCWS\Roll Tide.wav", 0, 3
End Sub
But it does not play in this one. I get Compile error: Sub or Function not defined. It works to load the lineup if I delete the PlaySound line.
The macro above was written in an earlier Excel version while the macro below was written in Excel365, if that matters.
Sub AwayAlabama2021()
'
' AwayAlabama2021 Macro
'
'
Sheets("Lineups").Select
Range("D1415:T1427").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Master").Select
Range("B4").Select
ActiveSheet.Paste
Range("Q4").Select
Application.CutCopyMode = False
Selection.Copy
Range("U2").Select
ActiveSheet.Paste
Sheets("Lineups").Select
Range("D1429:T1441").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Master").Select
ActiveWindow.SmallScroll Down:=3
Range("B32").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Calculate
ActiveWindow.SmallScroll Down:=-24
Range("A5").Select
PlaySound "D:\Smith's Data\Desktop\WCWS\Roll Tide.wav", 0, 3
End Sub
The wave file plays in some, but not others. Trying to figure out how they are different.
It plays it this one:
Sub AwayAlabama2012()
'
' AwayAlabama2012 Macro
'
'
Sheets("Lineups").Select
Range("D1415:T1427").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Master").Select
Range("B4").Select
ActiveSheet.Paste
Sheets("Lineups").Select
Range("D1429:T1441").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Master").Select
Range("B32").Select
ActiveSheet.Paste
Range("Q4").Select
Application.CutCopyMode = False
Selection.Copy
Range("U2").Select
ActiveSheet.Paste
PlaySound "D:\Smith's Data\Desktop\WCWS\Roll Tide.wav", 0, 3
End Sub
But it does not play in this one. I get Compile error: Sub or Function not defined. It works to load the lineup if I delete the PlaySound line.
The macro above was written in an earlier Excel version while the macro below was written in Excel365, if that matters.
Sub AwayAlabama2021()
'
' AwayAlabama2021 Macro
'
'
Sheets("Lineups").Select
Range("D1415:T1427").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Master").Select
Range("B4").Select
ActiveSheet.Paste
Range("Q4").Select
Application.CutCopyMode = False
Selection.Copy
Range("U2").Select
ActiveSheet.Paste
Sheets("Lineups").Select
Range("D1429:T1441").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Master").Select
ActiveWindow.SmallScroll Down:=3
Range("B32").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Calculate
ActiveWindow.SmallScroll Down:=-24
Range("A5").Select
PlaySound "D:\Smith's Data\Desktop\WCWS\Roll Tide.wav", 0, 3
End Sub