slow code execution

A

Atishoo

Im having trouble with very slow code execution on even some basic code are
freezing at "end with" at the end of the code
eg this sub for clearing the contents of an offset cell to the active cell.

Private Sub CommandButton28_Click()
With Worksheets("Main Board")
c = .Range("D82").Value
ActiveCell.Offset(c, 0) = " "
End With
End Sub

the only other sub that might run at the same time is a selection change sub
that is large and planning on becoming much larger, is there a way of
simplifying this to make it run quicker?
this sub brings the appropriate combo box into view close to the active cell
dependent on the range it falls within.
As you can see I have just piled one "with ... end with" ontop of another Im
thinking there may be a way of integrating this into one.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With ActiveSheet.ComboBox56
If Not Intersect(Target, Range("alertslist")) Is Nothing Then
.Visible = True
.Top = Target.Top + Target.Cells.Height
.Left = Target.Left
Else
.Visible = False
End If
End With
With ActiveSheet.ComboBox61
If Not Intersect(Target, Range("monworkers")) Is Nothing Then
.Visible = True
.Top = Target.Top + Target.Cells.Height
.Left = Target.Left
Else
.Visible = False
End If
End With
With ActiveSheet.ComboBox60
If Not Intersect(Target, Range("tueworkers")) Is Nothing Then
.Visible = True
.Top = Target.Top + Target.Cells.Height
.Left = Target.Left
Else
.Visible = False
End If
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top