loop problem

liam1289

New Member
Joined
Apr 27, 2011
Messages
16
im copy my 5 workin days into a new file the i ask the user to enter a class and iv to loop throught my workbook and delete all the classes that the person is in...
here some of my code but im badly stuck
i can copy all my files into a new work book. but just the looping and then delete is the problem


Dim g, block, start As Range
Dim ws As Worksheet
Dim class As String
Const maxrooms = 13
Const maxhours = 9
class = InputBox("Enter Class")
'if it is not the class selected then delete

Set start = Range("B3")
Set block = Range(start, start.Offset(maxhours - 1, maxrooms - 1))
For Each g In block
g.Activate
Next g
If Value = class Then Copy
Otherwise Delete





'and then loop through the 5 days of the week

For Each ws In Worksheets
ws.Activate

Next ws
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,224,566
Messages
6,179,553
Members
452,928
Latest member
101blockchains

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top