this is regarding a macro in an excel.
While a combination of keys are pressed (i.e. the macro is triggered), I need to do some format changes to the columns 1 to 10 of the row that has the ActiveCell.
At the moment I have am selecting the entire row
ActiveCell.EntireRow.Select
However, I need to select only the row 1 to 10. I think it ought to be something like
ActiveCell.Range(1, 10).Select
But that does not work.
Just to be clear, I have read about
ActiveCell.Offset(5, -4).Select
But that is not going to work in my case. The ActiveCell could be any column of the row and hence a hardcoded offset is not going to help.
So, the excel gurus there, I am hoping this is a quick stuff, just that somehow I can't find the answer. Please help.
If it is always columns 1 to 10 (i.e. A to J) then this ought to work:
Range("A" & ActiveCell.Row & ":J" & ActiveCell.Row)
For example if the activecell is M14
then this will select the range A14:J14
. You can then format this how you like.
Hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With