Cell Reference From Clicked Button

Jul 29, 2008

There was a similar question I found answered in the archives. However the solution given there (using ActiveSheet.Buttons(Application.Caller).TopLeftCell.xxx) does not work in my case.

A little googling and I think the reason is that I added my buttons from the toolbar and not from the forms editor. My buttons are in the OLEObjects collection, not in Buttons.

So how do I determine which of my OLEObjects was clicked? Is there something similar to "Application.Caller"?

View 9 Replies


ADVERTISEMENT

Reference ActiveX Button Which Has Been Clicked?

Mar 19, 2013

Is there a way in VBA to reference the activeX button which has been clicked? Like a ThisWorkbook equivalent for a button?

I have quite a few button whereby they set a parameter for a procedure 'TrendData' based on the row they sit in. Currently I just have the row number hard coded i.e. Call TrendData(5) but I want to amend this so that when I add a row it doesn't offset all my buttons.

For Example

Call TrendData(CommandButton3.TopLeftCell.Row)

However instead of typing CommandButton3, CommandButton4, etc. I would like the code to know which button had been clicked and just use that?

View 9 Replies View Related

Reference Cell Based On Button Location & Determine Button Used

Mar 7, 2008

I received this code from an example I found once upon a time that was originally submitted by someone else. Right now the code enters the current date in a cell of the same row as the checkbox when it's checked. I need to revise it, or come up with something similar, that will reference the value of a cell when it is in the same row as the button (from the Forms toolbar) that is clicked to activate the macro. First of all, I don't know how to reference a Forms button in VBA.

Sub Process_CheckBox()
Dim cBox As CheckBox
Dim LRow As Integer
Dim LRange As String
LName = Application.Caller
Set cBox = ActiveSheet.CheckBoxes(LName)
' Find row that checkbox resides in
LRow = cBox.TopLeftCell.Row
LRange = "B" & CStr(LRow)
'Change date in column B, if checkbox is checked
If cBox.Value > 0 Then
ActiveSheet.Range(LRange).Value = Date
'Clear date in column B, if checkbox is unchecked
Else
ActiveSheet.Range(LRange).Value = Null
End If
End Sub

Here is some other code I already created. Unfortunately, because I don't know how to do the row reference, I had to create 25 different macros, which just bulks up the size of my file and slows it down. But here is what I'm trying to accomplish in my macro:.............

View 8 Replies View Related

Determining Button Clicked

Aug 7, 2006

I have a spreadsheet with a variable number of xlButtonControl type form controls. The actual number of buttons depends on the amount of data that the spreadsheet is being asked to summarise. All the button controls use the ".OnAction" property to point execution on click to a common procedure.

Unfortunately that much is what it is and is beyond my control, so I just have to work with that.

What I would like to know is if there is a property or method I can access from within the common OnAction procedure that enable me to identify which button was pressed. If this was a CommandBar environment I would use the ActionControl property. Since it's not, and since I can't change it (not even to use ActiveX controls!), does anyone know an equivalent that I can use in this case?

View 4 Replies View Related

Button Color Change When Clicked

Oct 4, 2011

I have several buttons which, when clicked, pull up a range of data from another tab. Each button repopulates the appropriate cells with its specific data. I need to have an identification of which data set I'm currently viewing so was considering having the button, when clicked, change color or background/lettering colors swap, etc, until another button is clicked, then it changes color and the original button returns to the standard format. Is this possible? What type of button do I need to use?

View 1 Replies View Related

Call Macro If Button Is Clicked

Jan 30, 2009

I need a code for "click-able button" in my excel sheet that will call makro "copy" which I have connected with ThisWorkBook /Sub copy() .../ or in other case with Modules (module 7 for example).

So, what to add between this:

Private Sub CommandButton1_Click()

?

End Sub

View 9 Replies View Related

Get Column Number Of Clicked Button

May 3, 2005

Sub Mainscoresheet()
Dim k As Integer, i As Integer, cs As Integer
Set b = ActiveSheet.Buttons(Application.Caller)
With b.TopLeftCell
cs = .Column
End With

I have a button assigned to this macro about 20 times all over my worksheet
I will place the button in dirrerent locations. What I need to do is get the column that the top-left corner of the button and assign that to "cs".

Example if the top left corner of the button is in column "F" then cs would be 6.

View 9 Replies View Related

Disable Toolbar Button Until Another Clicked

Aug 1, 2006

I have two custom toolbar buttons. I want to disable one of them until the second will be pressed (sorry for my english).

View 3 Replies View Related

Stop Loop When Button Clicked

Dec 11, 2006

I have a form with two buttons, one is to start downloading, one is to stop it, a sub is called when start buuton is clicked, there is a DO LOOP, I hope the DO LOOP stop when I clicked STOP button,

View 9 Replies View Related

How To Change Command Button Name And Colour When Clicked

Aug 22, 2013

I have a command button that when pressed I would like the name written on it and colour to change

View 2 Replies View Related

Reset A Textbox In Userform When Button Is Clicked -

Jan 24, 2007

I can't find a way to reset/clear the textbox in order to enter new data

View 2 Replies View Related

1 Command Button To Do Different Task When Clicked A 2nd Time

Feb 1, 2008

Currently I have 5 identical command buttons which do something similar but in a different cell.

What i want to do is sum up the 5 different task using a single command button.

When cmdaddsp1 is clicked the first time cell "B4" is populated with a value from a table.
When cmdaddsp1 is clicked a second time cell "B5" is to be populated with a value from a table.
When cmdaddsp1 is clicked a third time cell "B6" is to be populated from the table,
and so forth.
Is there a loop or anything that can be used for this? I only want other cells to be populated when the command button is pressed.

View 9 Replies View Related

Button When Clicked Copy Values From A Column

Oct 19, 2008

i want to create a button in excel worksheet that when clicked copy values from a column (say A1 to A25) and store it so that it can be copied to word file or notepad or even in other excel worksheet. so i think i need a macro for this or it can be done by writing VBA Code.

View 9 Replies View Related

Form To Enter Date When Button Clicked

Mar 1, 2007

I am looking to create a form that when a user enters data in it, and clicks a save button it will submit that data into cell A2, and then with the next time the enter data it will submit that data to cell A3. I would like it to continue moving down a cell each time somone hits a "submit" button.

View 6 Replies View Related

Pull Hidden Frame When Clicked Command Button?

Mar 2, 2014

code to pull a hidden frame when I click a command button. I have Uploaded a Sample worksheet on my requirement.

View 4 Replies View Related

Radio Button Transparency Lost When Clicked, How To Remedy

Jan 23, 2009

I have a form (worksheet with controls embedded in) and the form changes color depending on what the user clicked, problem is that button colors and cell pattern colors don't quite match.

thought I solved it by making the buttons backstyle = transparent.
However, as soon as radio button was clicked, transparency was lost.

I have named the range of the form "FormGround" so that when Service 1 is select, the Form turn a different colour. I have my subsequent buttons change to that same color as well (using the cell's color index number.

View 4 Replies View Related

Spin Button To Increase Or Decrease By 1 Each Time It Is Clicked Up Or Down

May 18, 2009

I am having difficulty finding information on coding my spin button on a user form. I searched and haven't found any information. I need to do is code a spin button to increase or decrease by 1 each time it is clicked up or down. I would like it to populate to a text box on my form if that is possible.

View 3 Replies View Related

Minimize Userform And Give Focus To Immediate Next Window When Button Clicked

May 10, 2014

I currently have a small userform placed at the bottom right of the screen (with a command button on it) and this opens up on top of excel instances and other applications/windows and it is set so that you can't interact with anything except the userform.

I wanted to minimize the userform and give focus to immediate next window (can be excel or non excel applications) for 10 seconds and then activate/show the userform back again, when the "Button 1" on the userform is clicked.

I tried hiding the userform, but this doesn't give focus to the immediate next window. Below is the code

Private Sub Button_Click()
Me.Hide
PauseApp (10)
Me.Show
End Sub

I could only find answers for adding minimize and maximize buttons to userform.

When the button is clicked, it should perform

Step a - Minimize the userform
Step b - Give focus to the next immediate window behind the userform
Step c - Wait for 10 seconds
Step d - Bring back the userform its to state.

View 2 Replies View Related

Triggered When The Visaul Basic Editor Command Button Is Clicked

Apr 18, 2007

Can a event be triggered when the Visaul Basic Editor command button is clicked in Excel?

View 9 Replies View Related

Excel 2003 :: Userform - Ok Button To Delete Data When Clicked On In Combobox

May 8, 2012

I have a userform that has a combobox in it that also has an OK button and a Cancel Button. Need getting the combobox to pull in the correct list? The data for this list will be in cells A2 through A16. But not all 15 lines will always have data in them so I'd like to only show the ones with data. Then next issue i have is I would like the OK button on this userform to actually erase the data the user has clikced on in the combobox. It's a list of kids that the userform is asking which one needs to be deleted. So it might be the kid in cell A9. so when the user clicks on that kid in the combobox form a9 and hits ok I'd like to have all the kids below A9 move up one row.

Windows XP
excel 2003

View 6 Replies View Related

When Cell Clicked, Stays "clicked" Highlights All

Jan 10, 2007

What in the world did I do now? When I click on any cell, the cursor turns into a thick "+" . Then, when I move my mouse up and down the spreadsheet, all the cells the "+" touches become highlighted.

View 9 Replies View Related

Linking Cell To Row When Clicked?

Jul 16, 2014

When I am in my workbook and I click on a cell in a worksheet I would like to be able to have the row highlight when I click a cell, instead of trying to manually find it which at times I get lost with all the data on these sheets. Now my workbook is completed and all my formulas are done. Just trying to fine tune my databases with being able to do the "click this cell and the row highlights where I need to be" If this is possible I would like to do this for all 3 databases.

View 14 Replies View Related

Pop-up Calendar When Cell Is Clicked

Jan 19, 2008

Is it possible to modify the following codes so that if the active cell is formatted as Date when the cell is clicked the pop-up calendar shows.

View 11 Replies View Related

Insert A Value Into The Cell When Clicked In Vba

Oct 2, 2009

I need some VBA code which will insert a value into the cell when clicked.

First click = Value: 1
Second Click = Value: 2
Third Click = Value: "" (BLANK)

Cycle back to first click.

View 4 Replies View Related

When A Cell Is Clicked The Row Also Highlights - But How

Feb 23, 2007

I've seen a spreadsheet where the user can click on a cell, and the row the cell is in automatically highlights.

This is useful where there is a lot of columns, and it also looks pretty snazzy!

How do I do this? I know one way is to put the following code in when you right click the sheet tab and choose "view code":

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
UsedRange.EntireRow.Interior.ColorIndex = xlNone
ActiveCell.EntireRow.Interior.ColorIndex = 6
End Sub

But then I can't have nice background colours for other cells. Any suggestions?

btw, I've v. new to VBA - best to assume I know nothing!

View 9 Replies View Related

Add Clicked Cell Value To Formula

Apr 26, 2007

The idea is that once macro is started it will add the value of any clicked cell into the formula of the original cell.
ie.
1.start macro
2.click cell a5 (value=36)
3.type '+'
4.click cell b7 (value=21)
5.click enter to end macro
Result will be '=36+21' in the formula bar. The cell will then show the answer 57.

View 9 Replies View Related

Copying Value To Another Cell When Checkbox Clicked

May 17, 2014

I have 5 columns in excel and a value in each column, i.e. J23, L23, N23, P23, R23 (I have left columns blank in between each one).

The values in J23, L23, N23, P23, R23 are all different.

I'd like to place a Checkbox underneath each of these cells (each checkbox being specifically for the value in the cell above it) so that when I click one of the checkboxes, the value that is linked to that checkbox is then copied into another sell, for example Cell J31.

View 9 Replies View Related

Change Cell Colour When Clicked

May 26, 2006

I've found a great thread that answered part of my problem (Change colour of text on update of cell)

This code changes the colour of a cell when selected. With the application I'm trying to make I need this effect to only occur in a certain area say A10:D30

I'm trying to make a scheduling page that uses timebars to represent when people are working. I though if a user could click or highlight the hours and a time bar produced I could lookup to see what hour the timebar starts and ends and show the hours worked. I also need it to cycle through 5 different colours before returning to white.

Private Sub worksheet_change(ByVal target As Range)

target.Interior.ColorIndex = 4

End Sub

View 9 Replies View Related

Change Active Cell After Hyperlink Clicked

Dec 27, 2009

I have a column with entrys of 2 kinds. Some being Hyperlinks and others with normal type data. All cells are locked with password except for cells that will possibly have entrys made in them.

Is there a way to move the active cell to R1C1 after any hyperlink clicked? R1C1 is unlocked.

View 14 Replies View Related

Override The Data In The Cell When Checkbox Is Clicked

Sep 3, 2009

i am working on a spreadsheet that is doing two things 1) its allowing the user to choose between 1 to 3 number or N/A from the list validation option and 2) there is a checkbox if one selects that all the columns that have the formula will become N/A irrespect of data in it. I am using the following formula in the list validation option a3 is the check boc.

E5 =1
E6= 2
E7 = 3
E8=N/A

=if(a3=true, $E$8, $E$5:$E$8)

The issue I am having with this is, if I start selecting something from the drop down and half way I realize I need to check the box, it will only make it E8 value for the cells I have not touched and the ones I have already selected the drop down value it will remain. However I want it to override the value to E8 irrespect.

1) If the user of the spreadsheet clicks on the check box (this is in A3 cell) which i have linked it using format control then all the cell (Column E) that have the formula =if(A3=True, "N/A", ) will have N/A which is not applicable and not an error as you mentioned. I have successfully implemented this

2) If the user does not select the check box (a3) then each of the cell (Column E) has a drop down which the user can select either 1,2,3 or N/A. Which I have successfully implemented by using the data validations. Now the struggle I am having is as follows: I have attached the spreadsheet for your reference too.

Now if I select number 2 in cell E10, 2 in cell E11 and 3 in cell E 13 and you can see alll the other cell in column E are 0, because of the formula and the box in A3 is not checked in Tab 1. In Tab 2 I have checked the box everything turned N/A in column E except cells E10, E11 and E13 because I had previously selected 2,2,3 respectively. This is not what I want, what I want is when I check that box everything should turn to N/A basically an override function is what I want to created.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved