Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default Identify the column of a range by letter instead of number

Good afternoon, all!

I'm trying to reference a cell based on:

Whatever the column is that contains the range "ILHID" (currently column B)
and
target.row

At the moment, I can use range("B"&target.row), but I want to make this
dynamic, so that if the position of ILHID changes, the code will still work.

Can I either reference ILHID's column by its letter, or is there some clever
combination using CELLS that I could use (that I'm currently working on, but
not having a great deal of luck with)?

Thanks in advance

Pete

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Identify the column of a range by letter instead of number

Why not do a Find on ILHID and capture the column of the found cell? Help
has details on the Find method.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Peter Rooney" wrote in message
...
Good afternoon, all!

I'm trying to reference a cell based on:

Whatever the column is that contains the range "ILHID" (currently column

B)
and
target.row

At the moment, I can use range("B"&target.row), but I want to make this
dynamic, so that if the position of ILHID changes, the code will still

work.

Can I either reference ILHID's column by its letter, or is there some

clever
combination using CELLS that I could use (that I'm currently working on,

but
not having a great deal of luck with)?

Thanks in advance

Pete



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Identify the column of a range by letter instead of number

cells(Target.row,Range("ILHID").Column)

--
Regards,
Tom Ogilvy


"Peter Rooney" wrote in message
...
Good afternoon, all!

I'm trying to reference a cell based on:

Whatever the column is that contains the range "ILHID" (currently column

B)
and
target.row

At the moment, I can use range("B"&target.row), but I want to make this
dynamic, so that if the position of ILHID changes, the code will still

work.

Can I either reference ILHID's column by its letter, or is there some

clever
combination using CELLS that I could use (that I'm currently working on,

but
not having a great deal of luck with)?

Thanks in advance

Pete



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default Identify the column of a range by letter instead of number

Hi, Tom,

This solved part of the problem, but here's what I', REALLY trying to achieve:

MsgBox ("Entries in row " & Target.Row & " = " &
Application.WorksheetFunction _
.CountA(Cells(Target.Row, Range("ILHID").Column)) _
.Offset(0, 0).Resize(1,
Range("IssuesDatabaseStart").CurrentRegion.Columns .Count))

I want to check how many entries there are within the TARGET row of my
database. Unfortunately, the above (incorporating your solution) give me an
"invalid qualifier" message. I think it's something to do with usin CELLS
with application.worksheetfunction.counta.

What i want to do is, regardless of the column I'm in, say "from column B
(or wherever "ILHID" (which is the column header) may be, to the last column
in my database, tell me how many cells have entries in them"

Hope this clarifies things.

Cheers

Pete



"Tom Ogilvy" wrote:

cells(Target.row,Range("ILHID").Column)

--
Regards,
Tom Ogilvy


"Peter Rooney" wrote in message
...
Good afternoon, all!

I'm trying to reference a cell based on:

Whatever the column is that contains the range "ILHID" (currently column

B)
and
target.row

At the moment, I can use range("B"&target.row), but I want to make this
dynamic, so that if the position of ILHID changes, the code will still

work.

Can I either reference ILHID's column by its letter, or is there some

clever
combination using CELLS that I could use (that I'm currently working on,

but
not having a great deal of luck with)?

Thanks in advance

Pete




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default Identify the column of a range by letter instead of number

Hi, Bob!

Thanks for this, but here's what I'm, REALLY trying to achieve:

MsgBox ("Entries in row " & Target.Row & " = " &
Application.WorksheetFunction _
.CountA(Cells(Target.Row, Range("ILHID").Column)) _
.Offset(0, 0).Resize(1,
Range("IssuesDatabaseStart").CurrentRegion.Columns .Count))

I want to check how many entries there are within the TARGET row of my
database. Unfortunately, the above (incorporating Tom's solution) give me an
"invalid qualifier" message. I think it's something to do with usin CELLS
with application.worksheetfunction.counta.

What i want to do is, regardless of the column I'm in, say "from column B
(or wherever "ILHID" ,which is the column header may be), to the last column
in my database, tell me how many cells have entries in them"

Hope this clarifies things (should have done this first, I guess!

Cheers

Pete



"Bob Phillips" wrote:

Why not do a Find on ILHID and capture the column of the found cell? Help
has details on the Find method.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Peter Rooney" wrote in message
...
Good afternoon, all!

I'm trying to reference a cell based on:

Whatever the column is that contains the range "ILHID" (currently column

B)
and
target.row

At the moment, I can use range("B"&target.row), but I want to make this
dynamic, so that if the position of ILHID changes, the code will still

work.

Can I either reference ILHID's column by its letter, or is there some

clever
combination using CELLS that I could use (that I'm currently working on,

but
not having a great deal of luck with)?

Thanks in advance

Pete






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Identify the column of a range by letter instead of number

Sub ABC()
Set Target = Range("B9")
res = Application.WorksheetFunction _
.CountA(Cells(Target.Row, _
Range("ILHID").Column) _
.Resize(1, Range("IssuesDatabaseStart") _
.CurrentRegion.Columns.Count))
MsgBox res

End Sub

worked fine for me.

--
Regards,
Tom Ogilvy


"Peter Rooney" wrote in message
...
Hi, Tom,

This solved part of the problem, but here's what I', REALLY trying to

achieve:

MsgBox ("Entries in row " & Target.Row & " = " &
Application.WorksheetFunction _
.CountA(Cells(Target.Row, Range("ILHID").Column)) _
.Offset(0, 0).Resize(1,
Range("IssuesDatabaseStart").CurrentRegion.Columns .Count))

I want to check how many entries there are within the TARGET row of my
database. Unfortunately, the above (incorporating your solution) give me

an
"invalid qualifier" message. I think it's something to do with usin CELLS
with application.worksheetfunction.counta.

What i want to do is, regardless of the column I'm in, say "from column B
(or wherever "ILHID" (which is the column header) may be, to the last

column
in my database, tell me how many cells have entries in them"

Hope this clarifies things.

Cheers

Pete



"Tom Ogilvy" wrote:

cells(Target.row,Range("ILHID").Column)

--
Regards,
Tom Ogilvy


"Peter Rooney" wrote in message
...
Good afternoon, all!

I'm trying to reference a cell based on:

Whatever the column is that contains the range "ILHID" (currently

column
B)
and
target.row

At the moment, I can use range("B"&target.row), but I want to make

this
dynamic, so that if the position of ILHID changes, the code will still

work.

Can I either reference ILHID's column by its letter, or is there some

clever
combination using CELLS that I could use (that I'm currently working

on,
but
not having a great deal of luck with)?

Thanks in advance

Pete






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default Identify the column of a range by letter instead of number

Tom,

Still haven't got it, I'm afraid...

MsgBox ("Entries in row " & Target.Row & " = " &
Application.WorksheetFunction _
.CountA(Cells(Target.Row, Range("ILHID"), Column) _
.Resize(1,
Range("IssuesDatabaseStart").CurrentRegion.Columns .Count)))

gives me:

"Wrong Number or arguments or invalid property assignment"

I'm testing it as a MSGBOX before I actually do my logic testing.

Sorry, but it's late and my brain's tired!

Thanks

Pete






"Tom Ogilvy" wrote:

Sub ABC()
Set Target = Range("B9")
res = Application.WorksheetFunction _
.CountA(Cells(Target.Row, _
Range("ILHID").Column) _
.Resize(1, Range("IssuesDatabaseStart") _
.CurrentRegion.Columns.Count))
MsgBox res

End Sub

worked fine for me.

--
Regards,
Tom Ogilvy


"Peter Rooney" wrote in message
...
Hi, Tom,

This solved part of the problem, but here's what I', REALLY trying to

achieve:

MsgBox ("Entries in row " & Target.Row & " = " &
Application.WorksheetFunction _
.CountA(Cells(Target.Row, Range("ILHID").Column)) _
.Offset(0, 0).Resize(1,
Range("IssuesDatabaseStart").CurrentRegion.Columns .Count))

I want to check how many entries there are within the TARGET row of my
database. Unfortunately, the above (incorporating your solution) give me

an
"invalid qualifier" message. I think it's something to do with usin CELLS
with application.worksheetfunction.counta.

What i want to do is, regardless of the column I'm in, say "from column B
(or wherever "ILHID" (which is the column header) may be, to the last

column
in my database, tell me how many cells have entries in them"

Hope this clarifies things.

Cheers

Pete



"Tom Ogilvy" wrote:

cells(Target.row,Range("ILHID").Column)

--
Regards,
Tom Ogilvy


"Peter Rooney" wrote in message
...
Good afternoon, all!

I'm trying to reference a cell based on:

Whatever the column is that contains the range "ILHID" (currently

column
B)
and
target.row

At the moment, I can use range("B"&target.row), but I want to make

this
dynamic, so that if the position of ILHID changes, the code will still
work.

Can I either reference ILHID's column by its letter, or is there some
clever
combination using CELLS that I could use (that I'm currently working

on,
but
not having a great deal of luck with)?

Thanks in advance

Pete







  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default Identify the column of a range by letter instead of number

Tom,

My apologies - I had a typo - should have been Range("ILHID").Column) NOT

Range("ILHID"), Column)

This works fine - thank you VERY much.

Just time to fire it back before you think I didn't figure it out for myself
(assuming you bother to deign my stupidity with another posting!)

regards

Pete



"Peter Rooney" wrote:

Tom,

Still haven't got it, I'm afraid...

MsgBox ("Entries in row " & Target.Row & " = " &
Application.WorksheetFunction _
.CountA(Cells(Target.Row, Range("ILHID"), Column) _
.Resize(1,
Range("IssuesDatabaseStart").CurrentRegion.Columns .Count)))

gives me:

"Wrong Number or arguments or invalid property assignment"

I'm testing it as a MSGBOX before I actually do my logic testing.

Sorry, but it's late and my brain's tired!

Thanks

Pete






"Tom Ogilvy" wrote:

Sub ABC()
Set Target = Range("B9")
res = Application.WorksheetFunction _
.CountA(Cells(Target.Row, _
Range("ILHID").Column) _
.Resize(1, Range("IssuesDatabaseStart") _
.CurrentRegion.Columns.Count))
MsgBox res

End Sub

worked fine for me.

--
Regards,
Tom Ogilvy


"Peter Rooney" wrote in message
...
Hi, Tom,

This solved part of the problem, but here's what I', REALLY trying to

achieve:

MsgBox ("Entries in row " & Target.Row & " = " &
Application.WorksheetFunction _
.CountA(Cells(Target.Row, Range("ILHID").Column)) _
.Offset(0, 0).Resize(1,
Range("IssuesDatabaseStart").CurrentRegion.Columns .Count))

I want to check how many entries there are within the TARGET row of my
database. Unfortunately, the above (incorporating your solution) give me

an
"invalid qualifier" message. I think it's something to do with usin CELLS
with application.worksheetfunction.counta.

What i want to do is, regardless of the column I'm in, say "from column B
(or wherever "ILHID" (which is the column header) may be, to the last

column
in my database, tell me how many cells have entries in them"

Hope this clarifies things.

Cheers

Pete



"Tom Ogilvy" wrote:

cells(Target.row,Range("ILHID").Column)

--
Regards,
Tom Ogilvy


"Peter Rooney" wrote in message
...
Good afternoon, all!

I'm trying to reference a cell based on:

Whatever the column is that contains the range "ILHID" (currently

column
B)
and
target.row

At the moment, I can use range("B"&target.row), but I want to make

this
dynamic, so that if the position of ILHID changes, the code will still
work.

Can I either reference ILHID's column by its letter, or is there some
clever
combination using CELLS that I could use (that I'm currently working

on,
but
not having a great deal of luck with)?

Thanks in advance

Pete







  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Identify the column of a range by letter instead of number

Your original post didn't have a comma in it at that location. It was

Range("ILHID").Column


--
Regards,
Tom Ogilvy

"Peter Rooney" wrote in message
...
Tom,

My apologies - I had a typo - should have been Range("ILHID").Column) NOT

Range("ILHID"), Column)

This works fine - thank you VERY much.

Just time to fire it back before you think I didn't figure it out for

myself
(assuming you bother to deign my stupidity with another posting!)

regards

Pete



"Peter Rooney" wrote:

Tom,

Still haven't got it, I'm afraid...

MsgBox ("Entries in row " & Target.Row & " = " &
Application.WorksheetFunction _
.CountA(Cells(Target.Row, Range("ILHID"), Column) _
.Resize(1,
Range("IssuesDatabaseStart").CurrentRegion.Columns .Count)))

gives me:

"Wrong Number or arguments or invalid property assignment"

I'm testing it as a MSGBOX before I actually do my logic testing.

Sorry, but it's late and my brain's tired!

Thanks

Pete






"Tom Ogilvy" wrote:

Sub ABC()
Set Target = Range("B9")
res = Application.WorksheetFunction _
.CountA(Cells(Target.Row, _
Range("ILHID").Column) _
.Resize(1, Range("IssuesDatabaseStart") _
.CurrentRegion.Columns.Count))
MsgBox res

End Sub

worked fine for me.

--
Regards,
Tom Ogilvy


"Peter Rooney" wrote in

message
...
Hi, Tom,

This solved part of the problem, but here's what I', REALLY trying

to
achieve:

MsgBox ("Entries in row " & Target.Row & " = " &
Application.WorksheetFunction _
.CountA(Cells(Target.Row, Range("ILHID").Column)) _
.Offset(0, 0).Resize(1,
Range("IssuesDatabaseStart").CurrentRegion.Columns .Count))

I want to check how many entries there are within the TARGET row of

my
database. Unfortunately, the above (incorporating your solution)

give me
an
"invalid qualifier" message. I think it's something to do with usin

CELLS
with application.worksheetfunction.counta.

What i want to do is, regardless of the column I'm in, say "from

column B
(or wherever "ILHID" (which is the column header) may be, to the

last
column
in my database, tell me how many cells have entries in them"

Hope this clarifies things.

Cheers

Pete



"Tom Ogilvy" wrote:

cells(Target.row,Range("ILHID").Column)

--
Regards,
Tom Ogilvy


"Peter Rooney" wrote in

message
...
Good afternoon, all!

I'm trying to reference a cell based on:

Whatever the column is that contains the range "ILHID"

(currently
column
B)
and
target.row

At the moment, I can use range("B"&target.row), but I want to

make
this
dynamic, so that if the position of ILHID changes, the code will

still
work.

Can I either reference ILHID's column by its letter, or is there

some
clever
combination using CELLS that I could use (that I'm currently

working
on,
but
not having a great deal of luck with)?

Thanks in advance

Pete









  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default Identify the column of a range by letter instead of number

Tom,

I typed your solution incorrectly, then copied it back to you...

Just having a bad day, I guess! Thanks for your patience :-)

Pete



"Tom Ogilvy" wrote:

Your original post didn't have a comma in it at that location. It was

Range("ILHID").Column


--
Regards,
Tom Ogilvy

"Peter Rooney" wrote in message
...
Tom,

My apologies - I had a typo - should have been Range("ILHID").Column) NOT

Range("ILHID"), Column)

This works fine - thank you VERY much.

Just time to fire it back before you think I didn't figure it out for

myself
(assuming you bother to deign my stupidity with another posting!)

regards

Pete



"Peter Rooney" wrote:

Tom,

Still haven't got it, I'm afraid...

MsgBox ("Entries in row " & Target.Row & " = " &
Application.WorksheetFunction _
.CountA(Cells(Target.Row, Range("ILHID"), Column) _
.Resize(1,
Range("IssuesDatabaseStart").CurrentRegion.Columns .Count)))

gives me:

"Wrong Number or arguments or invalid property assignment"

I'm testing it as a MSGBOX before I actually do my logic testing.

Sorry, but it's late and my brain's tired!

Thanks

Pete






"Tom Ogilvy" wrote:

Sub ABC()
Set Target = Range("B9")
res = Application.WorksheetFunction _
.CountA(Cells(Target.Row, _
Range("ILHID").Column) _
.Resize(1, Range("IssuesDatabaseStart") _
.CurrentRegion.Columns.Count))
MsgBox res

End Sub

worked fine for me.

--
Regards,
Tom Ogilvy


"Peter Rooney" wrote in

message
...
Hi, Tom,

This solved part of the problem, but here's what I', REALLY trying

to
achieve:

MsgBox ("Entries in row " & Target.Row & " = " &
Application.WorksheetFunction _
.CountA(Cells(Target.Row, Range("ILHID").Column)) _
.Offset(0, 0).Resize(1,
Range("IssuesDatabaseStart").CurrentRegion.Columns .Count))

I want to check how many entries there are within the TARGET row of

my
database. Unfortunately, the above (incorporating your solution)

give me
an
"invalid qualifier" message. I think it's something to do with usin

CELLS
with application.worksheetfunction.counta.

What i want to do is, regardless of the column I'm in, say "from

column B
(or wherever "ILHID" (which is the column header) may be, to the

last
column
in my database, tell me how many cells have entries in them"

Hope this clarifies things.

Cheers

Pete



"Tom Ogilvy" wrote:

cells(Target.row,Range("ILHID").Column)

--
Regards,
Tom Ogilvy


"Peter Rooney" wrote in

message
...
Good afternoon, all!

I'm trying to reference a cell based on:

Whatever the column is that contains the range "ILHID"

(currently
column
B)
and
target.row

At the moment, I can use range("B"&target.row), but I want to

make
this
dynamic, so that if the position of ILHID changes, the code will

still
work.

Can I either reference ILHID's column by its letter, or is there

some
clever
combination using CELLS that I could use (that I'm currently

working
on,
but
not having a great deal of luck with)?

Thanks in advance

Pete










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
Identify the row in which a MAX number in a column resides BarDoomed Excel Worksheet Functions 7 June 5th 08 08:23 PM
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
Formula to Identify Column Number Michael Link Excel Discussion (Misc queries) 4 August 14th 05 03:18 PM
column header changed from letter to number, how return to letter Ron Excel Discussion (Misc queries) 2 May 9th 05 08:34 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 09:58 PM.

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

About Us

"It's about Microsoft Excel"