0

I'm hoping there's a simple solution, and I've searched for this here and on Google but haven't been able to find it, apologies if I missed it!

I need to identify (on VBA) what cell this navigates to:

Range("A1").Select
Selection.End(xlToRight).Offset(0, 1).Select

As it stands, the cell is V1, but this file is constantly changing and new columns are being added, so I always need to go to the first empty column to the right.

So, I basically need a way for the above code to confirm what cell that movement navigates to, and use this as a range I call refer to for the rest of my code.

I've tried a couple of things, but none of it has worked :(

Hope that makes sense! Any help would be greatly appreciated!

miguerian
  • 1
  • 2
  • 3
    `Set myRange = Range("A1").End(xlToRight).Offset(0, 1)` ? This will create a range called `myRange` that refers to the cell. If you want the address, you could use `myRange.Address`, or `myRange.Column` for the column number. – CLR Apr 08 '22 at 11:18
  • Cheers mate! I knew It was gonna be something simple! Much appreciated – miguerian Apr 08 '22 at 11:22
  • Side notes fyi: [How to avoid using Select in Excel VBA?](https://stackoverflow.com/questions/10714251/how-to-avoid-using-select-in-excel-vba?r=SearchResults&s=1|139.3193). Fully qualify your range references as without further specification `Range` refers to the currently active sheet which needn't be the one you are targeting. – T.M. Apr 08 '22 at 18:28

0 Answers0