A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Reference Column of Named Cell vba



 
 
Thread Tools Display Modes
  #1  
Old May 3rd, 2010, 12:40 PM posted to microsoft.public.excel.misc
Isis[_2_]
external usenet poster
 
Posts: 70
Default Reference Column of Named Cell vba

I have named a cell on sheet - how doe I reference just the column property
of that named cell in vba on another sheet in the same workbook please ?


Thanks
  #2  
Old May 3rd, 2010, 01:04 PM posted to microsoft.public.excel.misc
Dave Peterson
external usenet poster
 
Posts: 19,791
Default Reference Column of Named Cell vba

Dim myCell as range
set mycell = worksheets("somesheetname").range("SomeRangeName")

Then you can use something like:

msgbox mycell.column



Isis wrote:

I have named a cell on sheet - how doe I reference just the column property
of that named cell in vba on another sheet in the same workbook please ?

Thanks


--

Dave Peterson
  #3  
Old May 3rd, 2010, 01:24 PM posted to microsoft.public.excel.misc
Isis[_2_]
external usenet poster
 
Posts: 70
Default Reference Column of Named Cell vba

Dave Peterson wrote in
:

Dim myCell as range
set mycell = worksheets("somesheetname").range("SomeRangeName")

Then you can use something like:

msgbox mycell.column



Isis wrote:

I have named a cell on sheet - how doe I reference just the column
property of that named cell in vba on another sheet in the same
workbook please ?

Thanks



Hi Dave - thanks for the reply - that certainly looks like it does the job
but....

Is there no way to directly extract the column something like this (pseudo
code);

iColumn = Column(StaffHeader1)
Sheet6.Cells(3, iColumn + 1).Value = iStaffName

not complaining as your way will work, just a lot of code !

Thanks for taking the time to answer - appreciated

Regards
  #4  
Old May 3rd, 2010, 01:33 PM posted to microsoft.public.excel.misc
Isis[_2_]
external usenet poster
 
Posts: 70
Default Reference Column of Named Cell vba

Dave Peterson wrote in news:4BDEBBBD.B7AF3490
@verizonXSPAM.net:

msgbox mycell.column



Dave,

I am obviously doing something wrong as this code;

Dim myCell As Range
Set myCell = Worksheets("Sheet4").Range("StaffHeader1")
MsgBox myCell.Column

gives me a "subscript out of range error"

Any ideas ?

Thanks

PS I have a Sheet4 and StaffHeader1 is a named cell on that sheet
  #5  
Old May 3rd, 2010, 01:35 PM posted to microsoft.public.excel.misc
Dave Peterson
external usenet poster
 
Posts: 19,791
Default Reference Column of Named Cell vba

Dim iColumn as long
icolumn = worksheets("somesheetname").range("StaffHeader1"). column

Isis wrote:

Dave Peterson wrote in
:

Dim myCell as range
set mycell = worksheets("somesheetname").range("SomeRangeName")

Then you can use something like:

msgbox mycell.column



Isis wrote:

I have named a cell on sheet - how doe I reference just the column
property of that named cell in vba on another sheet in the same
workbook please ?

Thanks



Hi Dave - thanks for the reply - that certainly looks like it does the job
but....

Is there no way to directly extract the column something like this (pseudo
code);

iColumn = Column(StaffHeader1)
Sheet6.Cells(3, iColumn + 1).Value = iStaffName

not complaining as your way will work, just a lot of code !

Thanks for taking the time to answer - appreciated

Regards


--

Dave Peterson
  #6  
Old May 3rd, 2010, 01:37 PM posted to microsoft.public.excel.misc
Dave Peterson
external usenet poster
 
Posts: 19,791
Default Reference Column of Named Cell vba

Either your names aren't what you think they are (a typo or two???).

Or maybe Sheet4 is the CodeName of the sheet--not the name the user sees on the
sheet tab at the bottom of the screen in Excel????

Set myCell = Sheet4.Range("StaffHeader1")

(Check to see if that last character in staffheader? is really a one or an ell,
too.)

Isis wrote:

Dave Peterson wrote in news:4BDEBBBD.B7AF3490
@verizonXSPAM.net:

msgbox mycell.column



Dave,

I am obviously doing something wrong as this code;

Dim myCell As Range
Set myCell = Worksheets("Sheet4").Range("StaffHeader1")
MsgBox myCell.Column

gives me a "subscript out of range error"

Any ideas ?

Thanks

PS I have a Sheet4 and StaffHeader1 is a named cell on that sheet


--

Dave Peterson
  #7  
Old May 3rd, 2010, 01:44 PM posted to microsoft.public.excel.misc
Don Guillett[_2_]
external usenet poster
 
Posts: 607
Default Reference Column of Named Cell vba

Try?

Sub whichcolofnamedrng()
MsgBox Range("mydefinedname").Column
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Isis" wrote in message
...
I have named a cell on sheet - how doe I reference just the column property
of that named cell in vba on another sheet in the same workbook please ?


Thanks


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:42 AM.


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