Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
TWR TWR is offline
external usenet poster
 
Posts: 30
Default Hot to Get a Column Number from a column letter

Is there an easy way to get the column number from the column letter in Excel
2002 VBA, similar to the worksheet function =COLUMN(B:B) which equal 2?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Hot to Get a Column Number from a column letter

hi
one way
Range("B2").Value = Range("D1").Column
which would produce the number 4 in cell B2
there are a number of ways to use this.
with a variable
Dim r As Range
Set r = Range("B1")
Range("B2").Value = r.Column
with activecell
range("c1").select
Range("B2").Value = activecell.Column
and there are others.

hope this gets you started
regards
FSt1

"TWR" wrote:

Is there an easy way to get the column number from the column letter in Excel
2002 VBA, similar to the worksheet function =COLUMN(B:B) which equal 2?

  #3   Report Post  
Posted to microsoft.public.excel.programming
TWR TWR is offline
external usenet poster
 
Posts: 30
Default Hot to Get a Column Number from a column letter

Thanks, but I Don't want to write any data to the worksheet. I have a
userform that asks in which column certain data is. The response will be the
column letter.

Thanks for the suggestion though.

"FSt1" wrote:

hi
one way
Range("B2").Value = Range("D1").Column
which would produce the number 4 in cell B2
there are a number of ways to use this.
with a variable
Dim r As Range
Set r = Range("B1")
Range("B2").Value = r.Column
with activecell
range("c1").select
Range("B2").Value = activecell.Column
and there are others.

hope this gets you started
regards
FSt1

"TWR" wrote:

Is there an easy way to get the column number from the column letter in Excel
2002 VBA, similar to the worksheet function =COLUMN(B:B) which equal 2?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,118
Default Hot to Get a Column Number from a column letter

Perhaps something like this:

Range(strColEntered & "1").Column

Where strColEntered is a variable containing the Column Letter entered by
the user.

Is that something you can work with?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)

"TWR" wrote in message
...
Thanks, but I Don't want to write any data to the worksheet. I have a
userform that asks in which column certain data is. The response will be
the
column letter.

Thanks for the suggestion though.

"FSt1" wrote:

hi
one way
Range("B2").Value = Range("D1").Column
which would produce the number 4 in cell B2
there are a number of ways to use this.
with a variable
Dim r As Range
Set r = Range("B1")
Range("B2").Value = r.Column
with activecell
range("c1").select
Range("B2").Value = activecell.Column
and there are others.

hope this gets you started
regards
FSt1

"TWR" wrote:

Is there an easy way to get the column number from the column letter in
Excel
2002 VBA, similar to the worksheet function =COLUMN(B:B) which equal 2?



  #5   Report Post  
Posted to microsoft.public.excel.programming
TWR TWR is offline
external usenet poster
 
Posts: 30
Default Hot to Get a Column Number from a column letter

Yup, That's the spot. I knew my 14 lines of code was not the best way. How
do you MVP's keep up with all the questions?

Thank you !!

"Ron Coderre" wrote:

Perhaps something like this:

Range(strColEntered & "1").Column

Where strColEntered is a variable containing the Column Letter entered by
the user.

Is that something you can work with?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)

"TWR" wrote in message
...
Thanks, but I Don't want to write any data to the worksheet. I have a
userform that asks in which column certain data is. The response will be
the
column letter.

Thanks for the suggestion though.

"FSt1" wrote:

hi
one way
Range("B2").Value = Range("D1").Column
which would produce the number 4 in cell B2
there are a number of ways to use this.
with a variable
Dim r As Range
Set r = Range("B1")
Range("B2").Value = r.Column
with activecell
range("c1").select
Range("B2").Value = activecell.Column
and there are others.

hope this gets you started
regards
FSt1

"TWR" wrote:

Is there an easy way to get the column number from the column letter in
Excel
2002 VBA, similar to the worksheet function =COLUMN(B:B) which equal 2?






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 698
Default Hot to Get a Column Number from a column letter

You're very welcome....I'm glad I could help

***********
Regards,
Ron

XL2003, WinXP


"TWR" wrote:

Yup, That's the spot. I knew my 14 lines of code was not the best way. How
do you MVP's keep up with all the questions?

Thank you !!

"Ron Coderre" wrote:

Perhaps something like this:

Range(strColEntered & "1").Column

Where strColEntered is a variable containing the Column Letter entered by
the user.

Is that something you can work with?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)

"TWR" wrote in message
...
Thanks, but I Don't want to write any data to the worksheet. I have a
userform that asks in which column certain data is. The response will be
the
column letter.

Thanks for the suggestion though.

"FSt1" wrote:

hi
one way
Range("B2").Value = Range("D1").Column
which would produce the number 4 in cell B2
there are a number of ways to use this.
with a variable
Dim r As Range
Set r = Range("B1")
Range("B2").Value = r.Column
with activecell
range("c1").select
Range("B2").Value = activecell.Column
and there are others.

hope this gets you started
regards
FSt1

"TWR" wrote:

Is there an easy way to get the column number from the column letter in
Excel
2002 VBA, similar to the worksheet function =COLUMN(B:B) which equal 2?




  #7   Report Post  
Posted to microsoft.public.excel.programming
TWR TWR is offline
external usenet poster
 
Posts: 30
Default Hot to Get a Column Number from a column letter

PS: I posted another question titled 'How to get Popup Text help to work' on
1/4. 12.25 AM PST. Chip Pearson answered part of my question about MSForms
Controls and Windows handles for them but not actually about whether or not
UserForms actually do not support What's This help.

"Ron Coderre" wrote:

Perhaps something like this:

Range(strColEntered & "1").Column

Where strColEntered is a variable containing the Column Letter entered by
the user.

Is that something you can work with?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)

"TWR" wrote in message
...
Thanks, but I Don't want to write any data to the worksheet. I have a
userform that asks in which column certain data is. The response will be
the
column letter.

Thanks for the suggestion though.

"FSt1" wrote:

hi
one way
Range("B2").Value = Range("D1").Column
which would produce the number 4 in cell B2
there are a number of ways to use this.
with a variable
Dim r As Range
Set r = Range("B1")
Range("B2").Value = r.Column
with activecell
range("c1").select
Range("B2").Value = activecell.Column
and there are others.

hope this gets you started
regards
FSt1

"TWR" wrote:

Is there an easy way to get the column number from the column letter in
Excel
2002 VBA, similar to the worksheet function =COLUMN(B:B) which equal 2?




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 698
Default Hot to Get a Column Number from a column letter

Best to follow-up at that post. It'll probably get overlooked in this one.

***********
Regards,
Ron

XL2003, WinXP


"TWR" wrote:

PS: I posted another question titled 'How to get Popup Text help to work' on
1/4. 12.25 AM PST. Chip Pearson answered part of my question about MSForms
Controls and Windows handles for them but not actually about whether or not
UserForms actually do not support What's This help.

"Ron Coderre" wrote:

Perhaps something like this:

Range(strColEntered & "1").Column

Where strColEntered is a variable containing the Column Letter entered by
the user.

Is that something you can work with?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)

"TWR" wrote in message
...
Thanks, but I Don't want to write any data to the worksheet. I have a
userform that asks in which column certain data is. The response will be
the
column letter.

Thanks for the suggestion though.

"FSt1" wrote:

hi
one way
Range("B2").Value = Range("D1").Column
which would produce the number 4 in cell B2
there are a number of ways to use this.
with a variable
Dim r As Range
Set r = Range("B1")
Range("B2").Value = r.Column
with activecell
range("c1").select
Range("B2").Value = activecell.Column
and there are others.

hope this gets you started
regards
FSt1

"TWR" wrote:

Is there an easy way to get the column number from the column letter in
Excel
2002 VBA, similar to the worksheet function =COLUMN(B:B) which equal 2?




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I turn excel columns from column number to column letter? column Setting up and Configuration of Excel 1 April 29th 08 10:15 AM
Column Number from Column Letter Robert[_32_] Excel Programming 5 June 8th 07 01:42 PM
How to replace column letter in refferences with a function using the old column letter? Dmitry Kopnichev Excel Worksheet Functions 6 October 13th 05 09:09 AM
Get Column Letter from Column Number Gary Brown Excel Worksheet Functions 7 June 11th 05 02:08 AM
column header changed from letter to number, how return to letter Ron Excel Discussion (Misc queries) 2 May 9th 05 08:34 PM


All times are GMT +1. The time now is 04:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"