ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Process all cells in a (user) selection - vba (https://www.excelbanter.com/excel-programming/442298-process-all-cells-user-selection-vba.html)

Isis[_2_]

Process all cells in a (user) selection - vba
 
I am using this code to give me cell by cell access to a code defined
selection;

Dim aCell As Range
For Each aCell In Sheet4.Range("A4:A34")
' Do Stuff Here
Next aCell

which processes every cell in the A4:A34 Range

How do I do the same thing for a selection drawn by the user before
pressing my 'Process' button ?

Thanks

Ron Rosenfeld

Process all cells in a (user) selection - vba
 
On 05 May 2010 11:10:21 GMT, Isis wrote:

I am using this code to give me cell by cell access to a code defined
selection;

Dim aCell As Range
For Each aCell In Sheet4.Range("A4:A34")
' Do Stuff Here
Next aCell

which processes every cell in the A4:A34 Range

How do I do the same thing for a selection drawn by the user before
pressing my 'Process' button ?

Thanks



Dim aCell As Range
For Each aCell In Selection
' Do Stuff Here
Next aCell
--ron

Isis[_2_]

Process all cells in a (user) selection - vba
 
Ron Rosenfeld wrote in
:

Dim aCell As Range
For Each aCell In Selection
' Do Stuff Here
Next aCell


Ron, thanks very much for that - worked great !

Regards


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

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