Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Column number

How can I retrieve the column number of a cell in a specific row.
ie i want to get the column number of a cell in row 3 that holds the
value "successful" for instance
Thanks
Faby

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Column number

Hi Faby,

Try:

'=============
Public Sub Tester()
Dim rng As Range
Dim col As Long
Const rw As Long = 3

Set rng = Rows(rw).Find(What:="successful", _
After:=Rows(rw).Cells(1), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext)
If Not rng Is Nothing Then
col = rng.Column
MsgBox col
End If

End Sub
'<<=============



---
Regards,
Norman



"Faby" wrote in message
ups.com...
How can I retrieve the column number of a cell in a specific row.
ie i want to get the column number of a cell in row 3 that holds the
value "successful" for instance
Thanks
Faby



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Column number

When retrieving the column of a cell in these types of technques is there a
way to retrieve the column as a text character? I am trying to create names
in a loop and the column is dynamic so i use the activecell.column function
to retrieve the column. The name function gives me an error that the formula
you typed has an error. If I hard code my variable to be a letter instead of
a number it works.

thanks!
hckygirloh


"Norman Jones" wrote:

Hi Faby,

Try:

'=============
Public Sub Tester()
Dim rng As Range
Dim col As Long
Const rw As Long = 3

Set rng = Rows(rw).Find(What:="successful", _
After:=Rows(rw).Cells(1), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext)
If Not rng Is Nothing Then
col = rng.Column
MsgBox col
End If

End Sub
'<<=============



---
Regards,
Norman



"Faby" wrote in message
ups.com...
How can I retrieve the column number of a cell in a specific row.
ie i want to get the column number of a cell in row 3 that holds the
value "successful" for instance
Thanks
Faby




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Column number

Hi Hckygirloh,

It should not be necesasary to convert the column number.

Post your problematic code.


---
Regards,
Norman


"Hckygirloh" wrote in message
...
When retrieving the column of a cell in these types of technques is there
a
way to retrieve the column as a text character? I am trying to create
names
in a loop and the column is dynamic so i use the activecell.column
function
to retrieve the column. The name function gives me an error that the
formula
you typed has an error. If I hard code my variable to be a letter instead
of
a number it works.

thanks!
hckygirloh


"Norman Jones" wrote:

Hi Faby,

Try:

'=============
Public Sub Tester()
Dim rng As Range
Dim col As Long
Const rw As Long = 3

Set rng = Rows(rw).Find(What:="successful", _
After:=Rows(rw).Cells(1), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext)
If Not rng Is Nothing Then
col = rng.Column
MsgBox col
End If

End Sub
'<<=============



---
Regards,
Norman



"Faby" wrote in message
ups.com...
How can I retrieve the column number of a cell in a specific row.
ie i want to get the column number of a cell in row 3 that holds the
value "successful" for instance
Thanks
Faby






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Column number

Here is my code. If i hardcode the tmpTankCol variable to be 'A' or 'B' or
any other letter it works, when i run the code this way i get the "the
formula you typed has an error" message


tmpTankCol = ActiveCell.Column
Names.Add Name:=newName, RefersTo:="='POLARIS Tank Temp Input'!$" &
tmpTankCol & "$2:$" & tmpTankCol & "$13"

Thanks!!!
HckyGirlOH






"Norman Jones" wrote:

Hi Hckygirloh,

It should not be necesasary to convert the column number.

Post your problematic code.


---
Regards,
Norman


"Hckygirloh" wrote in message
...
When retrieving the column of a cell in these types of technques is there
a
way to retrieve the column as a text character? I am trying to create
names
in a loop and the column is dynamic so i use the activecell.column
function
to retrieve the column. The name function gives me an error that the
formula
you typed has an error. If I hard code my variable to be a letter instead
of
a number it works.

thanks!
hckygirloh



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
inverse of the column function? i.e. input a number, output thecorresponding column text label Brotherharry Excel Worksheet Functions 19 February 14th 09 12:37 AM
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
Count number of cells and total in one column, based on another column suffix Pierre Excel Worksheet Functions 5 October 31st 07 12:28 AM
Display missing Part Number if Column A does not match column B Erik T Excel Worksheet Functions 2 April 17th 06 11:23 PM
Auto number w/ different letter-number combos in same column Colleen B Excel Worksheet Functions 2 February 23rd 05 02:41 PM


All times are GMT +1. The time now is 02:57 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"