HorseGoose
Programmer
The worksheet has a grid containing raw materials, in order to format the worksheet correctly the first cell = "." if there is data in the row otherwise it is blank. The following code then goes through each row, if the row is blank it is hidden.
Other information, it is called from the activate sheet event and the screenupdating is set to false in there.
The code works fine, it is just glacially slow.
Sub bev_cogs_format()
' loops through the data lines which refer back the main beverage sheet
' if the line has nothing in it in terms of weight then it is hidden
' first unhide all the rows
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
Range("C18:C44").Select
Selection.EntireRow.Hidden = False
' then loop through each row and see if there is any weight entered, if not then hide the row
Dim loops As Integer
For loops = 18 To 66
Select Case Range("C" & loops)
Case Is = "."
Range("C" & loops).Select
Selection.EntireRow.Hidden = True
Case Else
' do nothing - do not hide the line because there is a weight
End Select
Next loops
' adds username and date and time the cogs sheet was generetae
Range("N5") = Environ("Username")
Range("N6") = Now()
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
End Sub
Other information, it is called from the activate sheet event and the screenupdating is set to false in there.
The code works fine, it is just glacially slow.
Sub bev_cogs_format()
' loops through the data lines which refer back the main beverage sheet
' if the line has nothing in it in terms of weight then it is hidden
' first unhide all the rows
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
Range("C18:C44").Select
Selection.EntireRow.Hidden = False
' then loop through each row and see if there is any weight entered, if not then hide the row
Dim loops As Integer
For loops = 18 To 66
Select Case Range("C" & loops)
Case Is = "."
Range("C" & loops).Select
Selection.EntireRow.Hidden = True
Case Else
' do nothing - do not hide the line because there is a weight
End Select
Next loops
' adds username and date and time the cogs sheet was generetae
Range("N5") = Environ("Username")
Range("N6") = Now()
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
End Sub