on action coding

mort1703

Active Member
Joined
Sep 13, 2008
Messages
266
I am using the following procedure within my excel project:

Code:
Public Sub ADDBUTTONS(ASheet)
Dim BILLCOUNT As Integer
Dim INCOMECOUNT As Integer
    BILLCOUNT = Worksheets("BILLS").Range("D1") 'HOLDS VALUE 19
    INCOMECOUNT = Worksheets("INCOME").Range("H1") 'HOLDS VALUE 7
    Worksheets(ASheet).Range("A1").Select
    ADDBUTTONCOUNT = 5 + BILLCOUNT
    ActiveCell.Offset(ADDBUTTONCOUNT, 1).Select
    For COUNTER = 0 To INCOMECOUNT - 1
        Selection.Copy
        ActiveSheet.Pictures.Paste.Select
        ActiveCell.Value = "CHANGE"
        ActiveCell.HorizontalAlignment = xlCenter
        ActiveCell.Font.Bold = True
        Selection.OnAction = "CHANGE"
        ActiveCell.Offset(1, 0).Select
    Next COUNTER
End Sub
when I use this procedure it creates the require result from a display perspective.

my dilema is as each button is running the same macro ie "CHANGE", how do I force the
"CHANGE" procedure to only work on the row selected
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
here is a code that works on cell change make a workbook name a worksheet w2 put a number in it then past that code in VBAs thisworkbook then insert a model past the sub mag in it, if you put cell a1 to 0 the mag will pop up. so now with this you can find a way to do yours.

Code:
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Sheets("w2").Select
 If Range("A1") = 0 Then
Call MsgExample1
Else
Exit Sub
End If
End Sub
Code:
Sub MsgExample1()
 MsgBox "Need To Purchase."
End Sub
 
Upvote 0

Forum statistics

Threads
1,203,462
Messages
6,055,562
Members
444,799
Latest member
CraigCrowhurst

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top