for my question I would like to create a button beside the cell that is not NULL or "". The caption for the button must follow the value in the cell beside.
For example:
- I typed 'EMPLOYEE' in
Range("D3")
- I want the macro to create a button named "EMPLOYEE" in the
Range("C3")
- However I want the macro to be dynamic so that every time I type in the value in the column 'D', the cell on the left side -
C3
will comes out a button.
Therefore, I've figured out that I needed to code for the CommandButton
manually is that right?
Nevertheless, million thanks in advance for all.
Try this out.
Open up the Developer Tab --> Visual Basic, double click "Sheet1", then paste this code in there. Test it by typing text in a cell on Sheet1 then moving away from that cell (e.g. by pressing Enter).
You may record a macro by adding a command button to see how it's created and then incorporate the fancy parts. Note on properties of OLE Command button object, pay more attention to them.
e.g.
theButton.Name
yet for caption is set viatheButton.Object.Caption
etc.Here is a code snippet to get you going:-
Output: