ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dynamic button creation (https://www.excelbanter.com/excel-programming/368168-dynamic-button-creation.html)

mazzarin

Dynamic button creation
 
Hi,

I have a column of numbers in an excel sheet. They can be any set of
numbers, but only within the range L15:L21

Is it possible, for every non-empty cell (maybe on error resume next?),
to create a button on top of the cell with the caption set as the
number IN the cell, and for it to call a script mulby(cell.value here)

Thanks for any assistance.


Die_Another_Day

Dynamic button creation
 
Why not just one button?
Sub ButtonMacro()
Call mulby(ActiveCell.Value)
End Sub

HTH

Die_Another_Day
mazzarin wrote:
Hi,

I have a column of numbers in an excel sheet. They can be any set of
numbers, but only within the range L15:L21

Is it possible, for every non-empty cell (maybe on error resume next?),
to create a button on top of the cell with the caption set as the
number IN the cell, and for it to call a script mulby(cell.value here)

Thanks for any assistance.



mazzarin

Dynamic button creation
 
Due to the way the spreadsheet is organized and what the function mulby
does, it needs to be seperate buttons for every value given.


Die_Another_Day wrote:
Why not just one button?
Sub ButtonMacro()
Call mulby(ActiveCell.Value)
End Sub

HTH

Die_Another_Day
mazzarin wrote:
Hi,

I have a column of numbers in an excel sheet. They can be any set of
numbers, but only within the range L15:L21

Is it possible, for every non-empty cell (maybe on error resume next?),
to create a button on top of the cell with the caption set as the
number IN the cell, and for it to call a script mulby(cell.value here)

Thanks for any assistance.



mazzarin

Dynamic button creation
 
Just to elaborate, I originally had one button, but when I submitted it
for review, people generally didn't like how that worked... they wanted
multiple buttons so they didn't have to think/type. This is the best
implementation I can think of for what was requested.


mazzarin wrote:
Due to the way the spreadsheet is organized and what the function mulby
does, it needs to be seperate buttons for every value given.


Die_Another_Day wrote:
Why not just one button?
Sub ButtonMacro()
Call mulby(ActiveCell.Value)
End Sub

HTH

Die_Another_Day
mazzarin wrote:
Hi,

I have a column of numbers in an excel sheet. They can be any set of
numbers, but only within the range L15:L21

Is it possible, for every non-empty cell (maybe on error resume next?),
to create a button on top of the cell with the caption set as the
number IN the cell, and for it to call a script mulby(cell.value here)

Thanks for any assistance.



Die_Another_Day

Dynamic button creation
 
What about using the before double-click event? Then all your lazy
users have to do is double click the cell they want.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
If Not Intersect(Target, Range("L15:L21")) Is Nothing Then
If Target.Value < "" Then
Call Mulby(Target.Value)
End If
End If
End Sub

if that doesn't work let me know when you want to create the buttons
and I will help you write the code.

Die_Another_Day
mazzarin wrote:
Just to elaborate, I originally had one button, but when I submitted it
for review, people generally didn't like how that worked... they wanted
multiple buttons so they didn't have to think/type. This is the best
implementation I can think of for what was requested.


mazzarin wrote:
Due to the way the spreadsheet is organized and what the function mulby
does, it needs to be seperate buttons for every value given.


Die_Another_Day wrote:
Why not just one button?
Sub ButtonMacro()
Call mulby(ActiveCell.Value)
End Sub

HTH

Die_Another_Day
mazzarin wrote:
Hi,

I have a column of numbers in an excel sheet. They can be any set of
numbers, but only within the range L15:L21

Is it possible, for every non-empty cell (maybe on error resume next?),
to create a button on top of the cell with the caption set as the
number IN the cell, and for it to call a script mulby(cell.value here)

Thanks for any assistance.



mazzarin

Dynamic button creation
 
That works! Hopefully everything goes well now.

Thanks.

Die_Another_Day wrote:
What about using the before double-click event? Then all your lazy
users have to do is double click the cell they want.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
If Not Intersect(Target, Range("L15:L21")) Is Nothing Then
If Target.Value < "" Then
Call Mulby(Target.Value)
End If
End If
End Sub

if that doesn't work let me know when you want to create the buttons
and I will help you write the code.

Die_Another_Day
mazzarin wrote:
Just to elaborate, I originally had one button, but when I submitted it
for review, people generally didn't like how that worked... they wanted
multiple buttons so they didn't have to think/type. This is the best
implementation I can think of for what was requested.


mazzarin wrote:
Due to the way the spreadsheet is organized and what the function mulby
does, it needs to be seperate buttons for every value given.


Die_Another_Day wrote:
Why not just one button?
Sub ButtonMacro()
Call mulby(ActiveCell.Value)
End Sub

HTH

Die_Another_Day
mazzarin wrote:
Hi,

I have a column of numbers in an excel sheet. They can be any set of
numbers, but only within the range L15:L21

Is it possible, for every non-empty cell (maybe on error resume next?),
to create a button on top of the cell with the caption set as the
number IN the cell, and for it to call a script mulby(cell.value here)

Thanks for any assistance.



mazzarin

Dynamic button creation
 
That works! Hopefully everything goes well now.

Thanks.

Die_Another_Day wrote:
What about using the before double-click event? Then all your lazy
users have to do is double click the cell they want.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
If Not Intersect(Target, Range("L15:L21")) Is Nothing Then
If Target.Value < "" Then
Call Mulby(Target.Value)
End If
End If
End Sub

if that doesn't work let me know when you want to create the buttons
and I will help you write the code.

Die_Another_Day
mazzarin wrote:
Just to elaborate, I originally had one button, but when I submitted it
for review, people generally didn't like how that worked... they wanted
multiple buttons so they didn't have to think/type. This is the best
implementation I can think of for what was requested.


mazzarin wrote:
Due to the way the spreadsheet is organized and what the function mulby
does, it needs to be seperate buttons for every value given.


Die_Another_Day wrote:
Why not just one button?
Sub ButtonMacro()
Call mulby(ActiveCell.Value)
End Sub

HTH

Die_Another_Day
mazzarin wrote:
Hi,

I have a column of numbers in an excel sheet. They can be any set of
numbers, but only within the range L15:L21

Is it possible, for every non-empty cell (maybe on error resume next?),
to create a button on top of the cell with the caption set as the
number IN the cell, and for it to call a script mulby(cell.value here)

Thanks for any assistance.




All times are GMT +1. The time now is 09:49 PM.

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