I have two windows open side by side. I want the smaller window to remain on one Sheet - Sheets("Control Panel")
in the other window (the larger one) I want all the stuff to happen.
The problem is, when I do paste special... or make a different sheet visible/invisible, it activates the pasted-in sheet for both windows.
I highlighted the spot in red where my small window suddenly jumps to the wrong sheet... when it shouldnt be moving...
Any idea what I'm doing wrong?
in the other window (the larger one) I want all the stuff to happen.
The problem is, when I do paste special... or make a different sheet visible/invisible, it activates the pasted-in sheet for both windows.
I highlighted the spot in red where my small window suddenly jumps to the wrong sheet... when it shouldnt be moving...
Any idea what I'm doing wrong?
Code:
Sub Set_Teachers()
Dim sT As Worksheet, sL As Worksheet
Set sT = Sheets("Teacher Schedule")
Set sL = Sheets("LayoutA")
Application.ScreenUpdating = False
Application.EnableEvents = False
Windows(MainWindow).Activate
[COLOR=#008000]'Paste Times[/COLOR]
[COLOR=#008000]'Monday[/COLOR]
sT.Range("H3:I35").Copy
[COLOR=#ff0000]sL.Range("B3:AH4").PasteSpecial Paste:=xlPasteValues, operation:=xlNone, SkipBlanks:=False, Transpose:=True[/COLOR]
Sheets("Base Schedule").Activate
Sheets("Teacher Schedule").Visible = False
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
Function MainWindow() As Integer
If Windows(1).Width > 0.5 * (Windows(1).Width + Windows(2).Width) Then [COLOR=#008000] 'returns the largest window... the main window[/COLOR]
MainWindow = 1
Else
MainWindow = 2
End If
End Function
[TABLE="width: 210"]
<colgroup><col span="2"></colgroup><tbody>[TR]
[TD][/TD]
[TD] [/TD]
[/TR]
</tbody>[/TABLE]