ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   reading cells by name/definition (https://www.excelbanter.com/excel-programming/374380-reading-cells-name-definition.html)

[email protected]

reading cells by name/definition
 
Hello all,
just wish to know is it possible to read excel cells by their name
instead of cell reference.

i.e. instead of using xlsheet.range(A4).value, can i use
xlsheet.range("my_given_name").value
where A4 is named as my_given_name ?


Bob Phillips

reading cells by name/definition
 
Did you try it? If you did you would answer your own question.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
oups.com...
Hello all,
just wish to know is it possible to read excel cells by their name
instead of cell reference.

i.e. instead of using xlsheet.range(A4).value, can i use
xlsheet.range("my_given_name").value
where A4 is named as my_given_name ?




[email protected]

reading cells by name/definition
 
i tried it and it generated an exception citing problems with
"getrange" method

just wish to know is it possible to access a cell content by its name?

Bob Phillips wrote:

Did you try it? If you did you would answer your own question.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
oups.com...
Hello all,
just wish to know is it possible to read excel cells by their name
instead of cell reference.

i.e. instead of using xlsheet.range(A4).value, can i use
xlsheet.range("my_given_name").value
where A4 is named as my_given_name ?



Bob Phillips

reading cells by name/definition
 
Which you didn't mention in your post.

It works, it must be your code somewhere.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
i tried it and it generated an exception citing problems with
"getrange" method

just wish to know is it possible to access a cell content by its name?

Bob Phillips wrote:

Did you try it? If you did you would answer your own question.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
oups.com...
Hello all,
just wish to know is it possible to read excel cells by their name
instead of cell reference.

i.e. instead of using xlsheet.range(A4).value, can i use
xlsheet.range("my_given_name").value
where A4 is named as my_given_name ?





[email protected]

reading cells by name/definition
 
thanks for the reply bob. but for some reason it is not working
exception thrown refers to this method
excel.worksheet.getrange(object cell1, object cell2)

I am passing the cell name as string to the range method

Bob Phillips wrote:

Which you didn't mention in your post.

It works, it must be your code somewhere.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
i tried it and it generated an exception citing problems with
"getrange" method

just wish to know is it possible to access a cell content by its name?

Bob Phillips wrote:

Did you try it? If you did you would answer your own question.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
oups.com...
Hello all,
just wish to know is it possible to read excel cells by their name
instead of cell reference.

i.e. instead of using xlsheet.range(A4).value, can i use
xlsheet.range("my_given_name").value
where A4 is named as my_given_name ?




Bob Phillips

reading cells by name/definition
 
I think you will need to post more code if you want a solution mate, we are
working blind.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
thanks for the reply bob. but for some reason it is not working
exception thrown refers to this method
excel.worksheet.getrange(object cell1, object cell2)

I am passing the cell name as string to the range method

Bob Phillips wrote:

Which you didn't mention in your post.

It works, it must be your code somewhere.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
i tried it and it generated an exception citing problems with
"getrange" method

just wish to know is it possible to access a cell content by its name?

Bob Phillips wrote:

Did you try it? If you did you would answer your own question.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
oups.com...
Hello all,
just wish to know is it possible to read excel cells by their name
instead of cell reference.

i.e. instead of using xlsheet.range(A4).value, can i use
xlsheet.range("my_given_name").value
where A4 is named as my_given_name ?






Bob Phillips

reading cells by name/definition
 
Here is an example demonstrating that it does work

Range("A1").Value = 99
Range("A1").Name = "my_named_range"
MsgBox Range("my_named_range").Value


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
thanks for the reply bob. but for some reason it is not working
exception thrown refers to this method
excel.worksheet.getrange(object cell1, object cell2)

I am passing the cell name as string to the range method

Bob Phillips wrote:

Which you didn't mention in your post.

It works, it must be your code somewhere.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
i tried it and it generated an exception citing problems with
"getrange" method

just wish to know is it possible to access a cell content by its name?

Bob Phillips wrote:

Did you try it? If you did you would answer your own question.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
oups.com...
Hello all,
just wish to know is it possible to read excel cells by their name
instead of cell reference.

i.e. instead of using xlsheet.range(A4).value, can i use
xlsheet.range("my_given_name").value
where A4 is named as my_given_name ?






[email protected]

reading cells by name/definition
 


String s
s=xlsheet1.Range(Chr(71) & j).Formula
xlsheet2.Range(Chr(67) & 1).Value=s
xlsheet2.Range(Chr(68) & 1).Value=xlsheet1.Range(s).Value

+++++++++++++++++++

the exception is thrown at the last line

System.Runtime.InterOpServices.COMException....... .
at Excel._Wroksheet.get_Range(Object Cell1, Object Cell2)




Bob Phillips wrote:

I think you will need to post more code if you want a solution mate, we are
working blind.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
thanks for the reply bob. but for some reason it is not working
exception thrown refers to this method
excel.worksheet.getrange(object cell1, object cell2)

I am passing the cell name as string to the range method

Bob Phillips wrote:

Which you didn't mention in your post.

It works, it must be your code somewhere.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
i tried it and it generated an exception citing problems with
"getrange" method

just wish to know is it possible to access a cell content by its name?

Bob Phillips wrote:

Did you try it? If you did you would answer your own question.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
oups.com...
Hello all,
just wish to know is it possible to read excel cells by their name
instead of cell reference.

i.e. instead of using xlsheet.range(A4).value, can i use
xlsheet.range("my_given_name").value
where A4 is named as my_given_name ?





Bob Phillips

reading cells by name/definition
 
Is this VB.Net? Afraid I am not a Netter, so I don't think I can help.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
oups.com...


String s
s=xlsheet1.Range(Chr(71) & j).Formula
xlsheet2.Range(Chr(67) & 1).Value=s
xlsheet2.Range(Chr(68) & 1).Value=xlsheet1.Range(s).Value

+++++++++++++++++++

the exception is thrown at the last line

System.Runtime.InterOpServices.COMException....... .
at Excel._Wroksheet.get_Range(Object Cell1, Object Cell2)




Bob Phillips wrote:

I think you will need to post more code if you want a solution mate, we

are
working blind.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
thanks for the reply bob. but for some reason it is not working
exception thrown refers to this method
excel.worksheet.getrange(object cell1, object cell2)

I am passing the cell name as string to the range method

Bob Phillips wrote:

Which you didn't mention in your post.

It works, it must be your code somewhere.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
i tried it and it generated an exception citing problems with
"getrange" method

just wish to know is it possible to access a cell content by its

name?

Bob Phillips wrote:

Did you try it? If you did you would answer your own question.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing

direct)

wrote in message
oups.com...
Hello all,
just wish to know is it possible to read excel cells by their

name
instead of cell reference.

i.e. instead of using xlsheet.range(A4).value, can i use
xlsheet.range("my_given_name").value
where A4 is named as my_given_name ?







NickHK[_3_]

reading cells by name/definition
 
I don't do .Net stuff, but what is the connection between these 2 pices of
code ?
And the subject ?

NickHK


egroups.com...


String s
s=xlsheet1.Range(Chr(71) & j).Formula
xlsheet2.Range(Chr(67) & 1).Value=s
xlsheet2.Range(Chr(68) & 1).Value=xlsheet1.Range(s).Value

+++++++++++++++++++

the exception is thrown at the last line

System.Runtime.InterOpServices.COMException....... .
at Excel._Wroksheet.get_Range(Object Cell1, Object Cell2)




Bob Phillips wrote:

I think you will need to post more code if you want a solution mate, we
are
working blind.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
thanks for the reply bob. but for some reason it is not working
exception thrown refers to this method
excel.worksheet.getrange(object cell1, object cell2)

I am passing the cell name as string to the range method

Bob Phillips wrote:

Which you didn't mention in your post.

It works, it must be your code somewhere.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
i tried it and it generated an exception citing problems with
"getrange" method

just wish to know is it possible to access a cell content by its
name?

Bob Phillips wrote:

Did you try it? If you did you would answer your own question.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
oups.com...
Hello all,
just wish to know is it possible to read excel cells by their
name
instead of cell reference.

i.e. instead of using xlsheet.range(A4).value, can i use
xlsheet.range("my_given_name").value
where A4 is named as my_given_name ?







NickHK[_3_]

reading cells by name/definition
 
OK, I see.
So what is the value of "s" ?
And you have a single cell named that on xlSheet1 ?

NickHK


egroups.com...


String s
s=xlsheet1.Range(Chr(71) & j).Formula
xlsheet2.Range(Chr(67) & 1).Value=s
xlsheet2.Range(Chr(68) & 1).Value=xlsheet1.Range(s).Value

+++++++++++++++++++

the exception is thrown at the last line

System.Runtime.InterOpServices.COMException....... .
at Excel._Wroksheet.get_Range(Object Cell1, Object Cell2)




Bob Phillips wrote:

I think you will need to post more code if you want a solution mate, we
are
working blind.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
thanks for the reply bob. but for some reason it is not working
exception thrown refers to this method
excel.worksheet.getrange(object cell1, object cell2)

I am passing the cell name as string to the range method

Bob Phillips wrote:

Which you didn't mention in your post.

It works, it must be your code somewhere.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
i tried it and it generated an exception citing problems with
"getrange" method

just wish to know is it possible to access a cell content by its
name?

Bob Phillips wrote:

Did you try it? If you did you would answer your own question.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
oups.com...
Hello all,
just wish to know is it possible to read excel cells by their
name
instead of cell reference.

i.e. instead of using xlsheet.range(A4).value, can i use
xlsheet.range("my_given_name").value
where A4 is named as my_given_name ?







[email protected]

reading cells by name/definition
 
sorry that I havent put up the whole code.

s is a string which gets a formula from a cell in xlsheet1 and copy it
to xlsheet2
this formula is a name which points to another cell, i am trying to get
the value of this last cell to copy also to xlsheet2

what bob wrote should work , but in my case i am passing it as a string
to range method whereas he passed it as a "Name" object.

NickHK wrote:

OK, I see.
So what is the value of "s" ?
And you have a single cell named that on xlSheet1 ?

NickHK


egroups.com...


String s
s=xlsheet1.Range(Chr(71) & j).Formula
xlsheet2.Range(Chr(67) & 1).Value=s
xlsheet2.Range(Chr(68) & 1).Value=xlsheet1.Range(s).Value

+++++++++++++++++++

the exception is thrown at the last line

System.Runtime.InterOpServices.COMException....... .
at Excel._Wroksheet.get_Range(Object Cell1, Object Cell2)




Bob Phillips wrote:

I think you will need to post more code if you want a solution mate, we
are
working blind.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
thanks for the reply bob. but for some reason it is not working
exception thrown refers to this method
excel.worksheet.getrange(object cell1, object cell2)

I am passing the cell name as string to the range method

Bob Phillips wrote:

Which you didn't mention in your post.

It works, it must be your code somewhere.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
i tried it and it generated an exception citing problems with
"getrange" method

just wish to know is it possible to access a cell content by its
name?

Bob Phillips wrote:

Did you try it? If you did you would answer your own question.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
oups.com...
Hello all,
just wish to know is it possible to read excel cells by their
name
instead of cell reference.

i.e. instead of using xlsheet.range(A4).value, can i use
xlsheet.range("my_given_name").value
where A4 is named as my_given_name ?






Bob Phillips

reading cells by name/definition
 
No, I passed it as a string to a range object.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
sorry that I havent put up the whole code.

s is a string which gets a formula from a cell in xlsheet1 and copy it
to xlsheet2
this formula is a name which points to another cell, i am trying to get
the value of this last cell to copy also to xlsheet2

what bob wrote should work , but in my case i am passing it as a string
to range method whereas he passed it as a "Name" object.

NickHK wrote:

OK, I see.
So what is the value of "s" ?
And you have a single cell named that on xlSheet1 ?

NickHK


egroups.com...


String s
s=xlsheet1.Range(Chr(71) & j).Formula
xlsheet2.Range(Chr(67) & 1).Value=s
xlsheet2.Range(Chr(68) & 1).Value=xlsheet1.Range(s).Value

+++++++++++++++++++

the exception is thrown at the last line

System.Runtime.InterOpServices.COMException....... .
at Excel._Wroksheet.get_Range(Object Cell1, Object Cell2)




Bob Phillips wrote:

I think you will need to post more code if you want a solution mate,

we
are
working blind.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
thanks for the reply bob. but for some reason it is not working
exception thrown refers to this method
excel.worksheet.getrange(object cell1, object cell2)

I am passing the cell name as string to the range method

Bob Phillips wrote:

Which you didn't mention in your post.

It works, it must be your code somewhere.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
i tried it and it generated an exception citing problems with
"getrange" method

just wish to know is it possible to access a cell content by

its
name?

Bob Phillips wrote:

Did you try it? If you did you would answer your own

question.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing

direct)

wrote in message
oups.com...
Hello all,
just wish to know is it possible to read excel cells by

their
name
instead of cell reference.

i.e. instead of using xlsheet.range(A4).value, can i use
xlsheet.range("my_given_name").value
where A4 is named as my_given_name ?









All times are GMT +1. The time now is 10:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com