Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a user selecting a range, how would I put the ending cell in the range
in a variable? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
dim rng as range
set rng = selection.cells(selection.cells.count) RBS "J@Y" wrote in message ... I have a user selecting a range, how would I put the ending cell in the range in a variable? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I guess there's no function for it because End(xldown) only goes to the first
blank cell. Thanks for the smart solution "RB Smissaert" wrote: dim rng as range set rng = selection.cells(selection.cells.count) RBS "J@Y" wrote in message ... I have a user selecting a range, how would I put the ending cell in the range in a variable? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Note that the code will not work if there are multiple areas selected. In that case:
Dim rng As Range Set rng = Selection.Areas(Selection.Areas.Count).Cells(Selec tion.Areas(Selection.Areas.Count).Cells.Count) HTH, Bernie MS Excel MVP "RB Smissaert" wrote in message ... dim rng as range set rng = selection.cells(selection.cells.count) RBS "J@Y" wrote in message ... I have a user selecting a range, how would I put the ending cell in the range in a variable? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the note.
"Bernie Deitrick" wrote: Note that the code will not work if there are multiple areas selected. In that case: Dim rng As Range Set rng = Selection.Areas(Selection.Areas.Count).Cells(Selec tion.Areas(Selection.Areas.Count).Cells.Count) HTH, Bernie MS Excel MVP "RB Smissaert" wrote in message ... dim rng as range set rng = selection.cells(selection.cells.count) RBS "J@Y" wrote in message ... I have a user selecting a range, how would I put the ending cell in the range in a variable? |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
an additional note/added caution is that that method isn't reliable: (to
illustrate from the immediate window). Set rng = Selection.Areas(Selection.Areas.Count).Cells(Selec tion.Areas(Selection.Areas.Count).Cells.Count) ? rng.Address $D$17 ? selection.Address $F$18:$G$21,$C$10:$E$14,$D$16:$D$17 I would have expected G21 to be the result. It depends on how the user selects the range. -- Regards, Tom Ogilvy "J@Y" wrote: Thanks for the note. "Bernie Deitrick" wrote: Note that the code will not work if there are multiple areas selected. In that case: Dim rng As Range Set rng = Selection.Areas(Selection.Areas.Count).Cells(Selec tion.Areas(Selection.Areas.Count).Cells.Count) HTH, Bernie MS Excel MVP "RB Smissaert" wrote in message ... dim rng as range set rng = selection.cells(selection.cells.count) RBS "J@Y" wrote in message ... I have a user selecting a range, how would I put the ending cell in the range in a variable? |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Check your previous post, too.
J@Y wrote: I have a user selecting a range, how would I put the ending cell in the range in a variable? -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find last row and column in a selected range | Excel Programming | |||
Macro to find empty cell and select range to print selected. | Excel Programming | |||
Find Findnext in selected range | Excel Programming | |||
how to find last row/col index within a selected range | Excel Programming | |||
VB code to find the selected cell | Excel Programming |