Hi,
This would be easier if I could share the workbook, but I have a particular sheet that doesn't have any data in it whatoever and it is running so slow that its not functional.
The intent is for data to be in there, but I am just optimising the entire workbook (ironically).
Does any of the following code look problematic? first is the worksheet code and then the workbook code.
thank you in advance.
Worksheet Code ("DataBase!"):
workbook Code:
This would be easier if I could share the workbook, but I have a particular sheet that doesn't have any data in it whatoever and it is running so slow that its not functional.
The intent is for data to be in there, but I am just optimising the entire workbook (ironically).
Does any of the following code look problematic? first is the worksheet code and then the workbook code.
thank you in advance.
Worksheet Code ("DataBase!"):
Code:
Private Sub Worksheet_Activate()
Range("A1:H1").Select
ActiveWindow.Zoom = True
Range("A" & Rows.Count).End(xlUp).Select
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng As Range
Dim cTop As Long
Dim cWidth As Long
Dim cmt As Comment
Dim Sh As Shape
Application.DisplayCommentIndicator _
= xlcommentIndicator0nly
Set rng = ActiveWindow.VisibleRange
cTop = rng.Top + rng.Height / 2
cWidth = rng.Left + rng.Width / 2
If ActiveCell.Comment Is Nothing Then
'do nothing
Else
Set cmt = ActiveCell.Comment
Set Sh = cmt.Shape
Sh.Top = cTop - Sh.Height / 2
Sh.Left = cWidth - Sh.Width / 2
cmt.Visible = True
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("D:D")) Is Nothing Then
colourDates Intersect(Target, Range("D:D")).Cells
End If
End Sub
workbook Code:
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("Warning").Visible = True
Sheets("SalesLog").Visible = xlVeryHidden
Sheets("Orders").Visible = xlVeryHidden
Sheets("Reporting").Visible = xlVeryHidden
Sheets("Settings").Visible = xlVeryHidden
Sheets("DataBase").Visible = xlVeryHidden
Sheets("Trends").Visible = xlVeryHidden
Sheets("Compare").Visible = xlVeryHidden
Sheets("Trend Data").Visible = xlVeryHidden
Sheets("Client File").Visible = xlVeryHidden
End Sub
Private Sub Workbook_Open()
Dim lastRow As Long
Sheets("SalesLog").Visible = True
Sheets("Orders").Visible = True
Sheets("Reporting").Visible = True
Sheets("Settings").Visible = xlHidden
Sheets("DataBase").Visible = True
Sheets("Trends").Visible = True
Sheets("Compare").Visible = True
Sheets("Trend Data").Visible = xlHidden
Sheets("Client File").Visible = True
Sheets("Reporting").Activate
Sheets("Warning").Visible = xlVeryHidden
With Sheets("Database")
If .AutoFilterMode Then
If .FilterMode Then .ShowAllData
End If
lastRow = .Cells(.Rows.Count, "D").End(xlUp).row
colourDates .Range("D5:D" & lastRow)
End With
End Sub