Forum Discussion
Macro excel 2013 : Failure excution
This is a simple exemple, I need to apply it anywhere in the sheet...
Sub CAP() ' ' CAP Macro ' ' ActiveCell.FormulaR1C1 = "=UPPER(RC[-1])" Range("D20").Select End Sub
Mehdi,
Replace that code with this:
Sub CAP() Selection = "=UPPER(RC[-1])" End Sub
You can apply it not only to a single cell but also to a range of cells!
- Mehdi BoulifaFeb 16, 2018Copper Contributor
What about any other macro, I will always use the same cells number !
if I would like to apply the same macro in a different place in the sheet !
it was an example that I sent to you, I want a general method.
- Haytham AmairahFeb 16, 2018Silver Contributor
You have to record a macro and modify it (If that needed) somehow to complete the required work.
You can use specific properties such as Selection, ActiveCell, ActiveSheet, ThisWorkbook...
You have an option of using http://www.excel-easy.com/vba/examples/use-relative-references.html which is useful in this context!
Sometimes, you may need to use some advanced tricks!
This depends on the work that you want to do.