the user has to select a room and iv to copy what classes it has and paste them into a new workbook but i keep getn error msg can anyone help
here is the code
Private Sub CommandButton2_Click()
Dim r, block As Range
Dim room As String
Dim ws As Worksheet
Const maxhours = 9
room = InputBox("Please enter Room") 'inputbox
For Each work In ActiveWorkbook.Worksheets
With ws
Cells.Find(What:="room").Activate
For block = 1 To maxhours 'loop down from the room number 9 hours in the day
For Each r In block
r.Activate
Selection.Copy
Windows("Room.XLS").Activate
ActiveSheet.Paste
Windows("Final.XLS").Activate
Next r
ws.Activate
Next ws
End Sub
here is the code
Private Sub CommandButton2_Click()
Dim r, block As Range
Dim room As String
Dim ws As Worksheet
Const maxhours = 9
room = InputBox("Please enter Room") 'inputbox
For Each work In ActiveWorkbook.Worksheets
With ws
Cells.Find(What:="room").Activate
For block = 1 To maxhours 'loop down from the room number 9 hours in the day
For Each r In block
r.Activate
Selection.Copy
Windows("Room.XLS").Activate
ActiveSheet.Paste
Windows("Final.XLS").Activate
Next r
ws.Activate
Next ws
End Sub