ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cells in a range (https://www.excelbanter.com/excel-programming/376501-cells-range.html)

David

Cells in a range
 
Hi Group,

I have selected a range of cells, but they are not contiguous, ie. A5, A7,
A9 through A15, A100, which I have done manually. I would like the code to go
through each cell selected, where I am drawing off information in cells to
the right of the selected cell. I have the code to get the information and
can do this easily on a single cell, but I would like to select as I have
outlined above and have the macro do the rest.

Thanks,
--
David

Bob Phillips

Cells in a range
 
For Each cell In Range("A5,A7,A9:A15,A100")
MsgBox cell.Offset(0, 1).Address
Next cell


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"David" wrote in message
...
Hi Group,

I have selected a range of cells, but they are not contiguous, ie. A5, A7,
A9 through A15, A100, which I have done manually. I would like the code to

go
through each cell selected, where I am drawing off information in cells to
the right of the selected cell. I have the code to get the information and
can do this easily on a single cell, but I would like to select as I have
outlined above and have the macro do the rest.

Thanks,
--
David




David

Cells in a range
 
The problem is setting the range selected. I found a way to step through a
named range, but i have to name the range manually. I was hoping I could set
a named range for the selected cells in the code. I set TestRange before I
start the code and it will "step" the named range, but the next time I want
to do this, the range will be different, it is dynamic. I would like to
rename the range with the new selection each time.

Thanks,
--
David


"Bob Phillips" wrote:

For Each cell In Range("A5,A7,A9:A15,A100")
MsgBox cell.Offset(0, 1).Address
Next cell


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"David" wrote in message
...
Hi Group,

I have selected a range of cells, but they are not contiguous, ie. A5, A7,
A9 through A15, A100, which I have done manually. I would like the code to

go
through each cell selected, where I am drawing off information in cells to
the right of the selected cell. I have the code to get the information and
can do this easily on a single cell, but I would like to select as I have
outlined above and have the macro do the rest.

Thanks,
--
David





David

Cells in a range
 
There is not a way to do this that I know of. Easy to delete a named range,
but not a way to know what is currently selected in a range, especially if
the range is not contiguous and then name it. Any ideas would be welcome.
Selecting and naming the range prior to starting the macro works well, but I
would like it to happen in the macro.

Thanks,
--
David


"Bob Phillips" wrote:

For Each cell In Range("A5,A7,A9:A15,A100")
MsgBox cell.Offset(0, 1).Address
Next cell


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"David" wrote in message
...
Hi Group,

I have selected a range of cells, but they are not contiguous, ie. A5, A7,
A9 through A15, A100, which I have done manually. I would like the code to

go
through each cell selected, where I am drawing off information in cells to
the right of the selected cell. I have the code to get the information and
can do this easily on a single cell, but I would like to select as I have
outlined above and have the macro do the rest.

Thanks,
--
David






All times are GMT +1. The time now is 05:20 AM.

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