![]() |
Columns letter of selection
Hi all,
if I select cells B2 to D2, and I run this VBA code : MsgBox Selection.Address(False, False) it gives me B2:D2. I'd like to get the columns only, like B:D So I tried : MsgBox Columns(Selection.Column).Address(False, False) but it gives me B:B Is there an easy way to solve this without playing with left, right, mid or instr ? Thanks for any insight, Nicomus |
Columns letter of selection
Hi Nicodemus,
Try: Selection.EntireColumn.Address(0, 0) --- Regards, Norman "Nicodemus" wrote in message ... Hi all, if I select cells B2 to D2, and I run this VBA code : MsgBox Selection.Address(False, False) it gives me B2:D2. I'd like to get the columns only, like B:D So I tried : MsgBox Columns(Selection.Column).Address(False, False) but it gives me B:B Is there an easy way to solve this without playing with left, right, mid or instr ? Thanks for any insight, Nicomus |
Columns letter of selection
Hi Norman,
great ! It works perfectly the way I wanted it !! Thank you for your (very) fast and efficient answer. Nicodemus "Norman Jones" wrote: Hi Nicodemus, Try: Selection.EntireColumn.Address(0, 0) --- Regards, Norman "Nicodemus" wrote in message ... Hi all, if I select cells B2 to D2, and I run this VBA code : MsgBox Selection.Address(False, False) it gives me B2:D2. I'd like to get the columns only, like B:D So I tried : MsgBox Columns(Selection.Column).Address(False, False) but it gives me B:B Is there an easy way to solve this without playing with left, right, mid or instr ? Thanks for any insight, Nicomus |
All times are GMT +1. The time now is 10:01 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com