Thursday 26 September 2019

excel - How to get the range of selected cells using VBA?

I'm trying to write an Excel Macro using VBA. The problem is, the cells processed in this macro are selected by user, so I can't predefine the range.




Here is my code:



Range(???).Select
Selection.FormulaR1C1 = StrConv(Selection.Text, 3)


How do I take the range of selected cells to fill in "???" in the code above?



n.b.: User can select any range they want, and they can use this macro more than once.




Thanks in advance!

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...