Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How come this piece of code does not work?
Dim Headers As Range Set Headers = Range(Cells(ImNavigateRow - 1, 2), Cells(ImNavigateRow - 1, 2).End(xlToRight).Column) I get an: Method 'Range' of object '_worksheet' failed error. Can anyone correct this for me? Thanks The Doctor |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Perhaps this is what you are trying to do?
Set Headers = Range(Cells(ImNavigateRow - 1, 2), Cells(ImNavigateRow - 1, Cells(ImNavigateRow-1,2).End(xlToRight).Column)) "Dr.Schwartz" wrote: How come this piece of code does not work? Dim Headers As Range Set Headers = Range(Cells(ImNavigateRow - 1, 2), Cells(ImNavigateRow - 1, 2).End(xlToRight).Column) I get an: Method 'Range' of object '_worksheet' failed error. Can anyone correct this for me? Thanks The Doctor |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yes thank you it works, but I think I'm going to use Norman's solution (is't
shorter) "K Dales" wrote: Perhaps this is what you are trying to do? Set Headers = Range(Cells(ImNavigateRow - 1, 2), Cells(ImNavigateRow - 1, Cells(ImNavigateRow-1,2).End(xlToRight).Column)) "Dr.Schwartz" wrote: How come this piece of code does not work? Dim Headers As Range Set Headers = Range(Cells(ImNavigateRow - 1, 2), Cells(ImNavigateRow - 1, 2).End(xlToRight).Column) I get an: Method 'Range' of object '_worksheet' failed error. Can anyone correct this for me? Thanks The Doctor |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Dr. Schwartz,
Try: Set Headers = Range(Cells(ImNavigateRow - 1, 2), _ Cells(ImNavigateRow - 1, 2).End(xlToRight)) --- Regards, Norman "Dr.Schwartz" wrote in message ... How come this piece of code does not work? Dim Headers As Range Set Headers = Range(Cells(ImNavigateRow - 1, 2), Cells(ImNavigateRow - 1, 2).End(xlToRight).Column) I get an: Method 'Range' of object '_worksheet' failed error. Can anyone correct this for me? Thanks The Doctor |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
As always (2 for 2) you deliver, thank you Norman.
"Norman Jones" wrote: Hi Dr. Schwartz, Try: Set Headers = Range(Cells(ImNavigateRow - 1, 2), _ Cells(ImNavigateRow - 1, 2).End(xlToRight)) --- Regards, Norman "Dr.Schwartz" wrote in message ... How come this piece of code does not work? Dim Headers As Range Set Headers = Range(Cells(ImNavigateRow - 1, 2), Cells(ImNavigateRow - 1, 2).End(xlToRight).Column) I get an: Method 'Range' of object '_worksheet' failed error. Can anyone correct this for me? Thanks The Doctor |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
help with the syntax for using range name in a formula? | Excel Discussion (Misc queries) | |||
VB Syntax to select a range | Excel Discussion (Misc queries) | |||
Need help with creating a Range Name syntax | Setting up and Configuration of Excel | |||
range and cells syntax | Excel Worksheet Functions | |||
Syntax for Range Reference | Excel Programming |