Tickboxes and the macro's behind them

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am having a small problem with a tickbox on a worksheet and I hope someone
can help.

When I click the tickbox to out a tick in it it shows one of the userforms I
have created and then runs the associated macro for the click.

I have debugged the code and it seems that the userform is getting called
before it runs the macro.

I just doesn't make sense to me.

Thanks in advance for any help.
 
Here's the code behind the tickbox :-

Sub Health_Month_End_Click()
Application.ScreenUpdating = False
Call Sort_Extra_Batch("Healthcare")
End Sub

The "Sort_Extra_Batch" is a routine that I have written. Here's the code
for that :-

Sub Sort_Extra_Batch(System_Name As String)
Sheets("Front End").Select
Select Case System_Name
Case "Life"
Sort_Range = "C15:D29"
Sort_Key = "C15"
Highlight_Cell = "B7"
Case "Bank"
Sort_Range = "G15:H29"
Sort_Key = "G15"
Highlight_Cell = "F7"
Case "Investment"
Sort_Range = "K15:L29"
Sort_Key = "K15"
Highlight_Cell = "J7"
Case "Healthcare"
Sort_Range = "O15:P29"
Sort_Key = "O15"
Highlight_Cell = "N7"
End Select
Range(Sort_Range).Select
Selection.Sort Key1:=Range(Sort_Key), Order1:=xlDescending, Header:=xlNo _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Highlight_Status (Highlight_Cell)
Home_Cell
End Sub

As I said it displays the userform before it executes any of the above code...
 
Managed to figure this out, had another linked cell pointing to the wrong
place. Sort that and everything is working as designed.

Thank for trying to help Duncan...
 
Sorry Deke,

Forgot to look back at your post.....Im not sure I would have worked
out that a cell was pointing to the wrong place anyway if thats any
consolation!.

ah well, im glad you managed to fix it anyway.

Sorry

Duncan
 

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

Back
Top