ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Find the beginning Cell of a Range (https://www.excelbanter.com/excel-discussion-misc-queries/146629-find-beginning-cell-range.html)

J@Y

Find the beginning Cell of a Range
 
I have a user input a range, how can I store the beginning cell of that range
in a variable?

Dave Peterson

Find the beginning Cell of a Range
 
Dim myRng as range
dim myCell as range

'somewhat the user defines myRng

set mycell = myrng.cells(1)



J@Y wrote:

I have a user input a range, how can I store the beginning cell of that range
in a variable?


--

Dave Peterson

J@Y

Find the beginning Cell of a Range
 
Thanks. What about the last cell?

"Dave Peterson" wrote:

Dim myRng as range
dim myCell as range

'somewhat the user defines myRng

set mycell = myrng.cells(1)



J@Y wrote:

I have a user input a range, how can I store the beginning cell of that range
in a variable?


--

Dave Peterson


Dave Peterson

Find the beginning Cell of a Range
 
In a one area range:

Dim myRng as range
dim myCell as range

'somewhat the user defines myRng

with myrng
set mycell = .cells(.cells.count)
end with

with a multi-area range

with myrng
with .areas(.areas.count)
set mycell = .cells(.cells.count)
end with
end with




J@Y wrote:

Thanks. What about the last cell?

"Dave Peterson" wrote:

Dim myRng as range
dim myCell as range

'somewhat the user defines myRng

set mycell = myrng.cells(1)



J@Y wrote:

I have a user input a range, how can I store the beginning cell of that range
in a variable?


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 03:56 PM.

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