Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Finding column of a particular cell

I have the following data in columns A to E:
414816 414251 420374 420101 420121

user will be requested to enter the desired 6 digit number and I would like
to establish the related column to use for updating certain cells in that
column.

Can anyone give me codes to achieve this?

Thank you
Prema
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Finding column of a particular cell

Dim ans as String, num as Long
Dim res as Variant
ans = Inputbox("Enter 6 digit number")
if isnumeric(ans) and len(trim(ans)) = 6 then
num = clng(ans)
res = application.Match(num, range("A1:E1"),0)
if not iserror(res) then
col = range("A1")(1, res).Column
else
msgbox "Not found"
end if
End if

--
Regards,
Tom Ogilvy

"Prema" wrote in message
...
I have the following data in columns A to E:
414816 414251 420374 420101 420121

user will be requested to enter the desired 6 digit number and I would

like
to establish the related column to use for updating certain cells in that
column.

Can anyone give me codes to achieve this?

Thank you
Prema



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Finding column of a particular cell

Thank you for your help. I had code similar to this and got the number for
the relevant column which I can use to look up to convert to letter of the
column to be used in the following way.
Say if the column where the entered 6 digit number was E then I would like
to update cell E5. That is why I would like the letter rather than the
number. If I use your code can I get to the cell by Range(col &
"5").Select?

Prema

"Tom Ogilvy" wrote:

Dim ans as String, num as Long
Dim res as Variant
ans = Inputbox("Enter 6 digit number")
if isnumeric(ans) and len(trim(ans)) = 6 then
num = clng(ans)
res = application.Match(num, range("A1:E1"),0)
if not iserror(res) then
col = range("A1")(1, res).Column
else
msgbox "Not found"
end if
End if

--
Regards,
Tom Ogilvy

"Prema" wrote in message
...
I have the following data in columns A to E:
414816 414251 420374 420101 420121

user will be requested to enter the desired 6 digit number and I would

like
to establish the related column to use for updating certain cells in that
column.

Can anyone give me codes to achieve this?

Thank you
Prema




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Finding column of a particular cell

In a later posting of the question, Prema agreed that having col was all
that was necessary.

--
Regards,
Tom Ogilvy


"Prema" wrote in message
...
Thank you for your help. I had code similar to this and got the number for
the relevant column which I can use to look up to convert to letter of the
column to be used in the following way.
Say if the column where the entered 6 digit number was E then I would like
to update cell E5. That is why I would like the letter rather than the
number. If I use your code can I get to the cell by Range(col &
"5").Select?

Prema

"Tom Ogilvy" wrote:

Dim ans as String, num as Long
Dim res as Variant
ans = Inputbox("Enter 6 digit number")
if isnumeric(ans) and len(trim(ans)) = 6 then
num = clng(ans)
res = application.Match(num, range("A1:E1"),0)
if not iserror(res) then
col = range("A1")(1, res).Column
else
msgbox "Not found"
end if
End if

--
Regards,
Tom Ogilvy

"Prema" wrote in message
...
I have the following data in columns A to E:
414816 414251 420374 420101 420121

user will be requested to enter the desired 6 digit number and I would

like
to establish the related column to use for updating certain cells in

that
column.

Can anyone give me codes to achieve this?

Thank you
Prema






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Finding column of a particular cell

Thank you for your help. I had code similar to this and got the number for
the relevant column which I can use to look up to convert to letter of the
column to be used in the following way.
Say if the column where the entered 6 digit number was E then I would like
to update cell E5. That is why I would like the letter rather than the
number. If I use your code can I get to the cell by Range(col &
"5").Select?

Prema

"Tom Ogilvy" wrote:

Dim ans as String, num as Long
Dim res as Variant
ans = Inputbox("Enter 6 digit number")
if isnumeric(ans) and len(trim(ans)) = 6 then
num = clng(ans)
res = application.Match(num, range("A1:E1"),0)
if not iserror(res) then
col = range("A1")(1, res).Column
else
msgbox "Not found"
end if
End if

--
Regards,
Tom Ogilvy

"Prema" wrote in message
...
I have the following data in columns A to E:
414816 414251 420374 420101 420121

user will be requested to enter the desired 6 digit number and I would

like
to establish the related column to use for updating certain cells in that
column.

Can anyone give me codes to achieve this?

Thank you
Prema






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
Finding First Empty Cell in a Column TomHull Excel Discussion (Misc queries) 0 November 9th 09 12:21 AM
Finding a cell and returning value from a different row and column RJBohn3 Excel Discussion (Misc queries) 1 May 23rd 09 01:13 AM
Finding last cell with data in a column Nigel Bennett Setting up and Configuration of Excel 2 April 29th 05 08:03 PM
Finding the last used cell in a column Ben's Oak Excel Programming 5 July 16th 04 04:12 AM
Finding next Blank Cell in Column trickdos[_3_] Excel Programming 2 May 19th 04 04:33 PM


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