ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Tickboxes and the macro's behind them (https://www.excelbanter.com/excel-programming/359118-tickboxes-macros-behind-them.html)

Deke

Tickboxes and the macro's behind them
 
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.

--
Cheers...

Duncan[_5_]

Tickboxes and the macro's behind them
 
can you post the code behind the tickbox?


Deke

Tickboxes and the macro's behind them
 
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...

--
Cheers...


"Duncan" wrote:

can you post the code behind the tickbox?



Duncan[_5_]

Tickboxes and the macro's behind them
 
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



All times are GMT +1. The time now is 06:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com