ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Range problem (https://www.excelbanter.com/excel-programming/342268-range-problem.html)

David Goodall[_2_]

Range problem
 
Morning
I'm using the following code to find the last empty column and then the last
empty row. I then want to use add information to the next column but only
within the range I've found.

Here is what I have so far:
ActiveSheet.Range("A1").End(xlToRight).Select 'finds first blank column
rng1 = ActiveCell.AddressLocal(RowAbsolute:=False)
rng1 = RemoveChar(rng1) 'function that removes the $
rng2 = Range((rng1),
Range(rng1).End(xlDown)).AddressLocal(RowAbsolute: =False)
rng2 = RemoveChar(rng2) 'function that removes the $
'rng2 is now the string O1:O50

Range(rng2).Select

I now want to apply my range to a range variable Rng.

Rng = range(rng2) - this doesn't work however. Once I've done this I will
use the offset function to add my information.

Any help is greatly appreciated. Could I improve the code above?




David Goodall[_2_]

Range problem
 
Apologies - I've found the solution - please ignore.
"David Goodall" wrote in message
...
Morning
I'm using the following code to find the last empty column and then the
last empty row. I then want to use add information to the next column but
only within the range I've found.

Here is what I have so far:
ActiveSheet.Range("A1").End(xlToRight).Select 'finds first blank column
rng1 = ActiveCell.AddressLocal(RowAbsolute:=False)
rng1 = RemoveChar(rng1) 'function that removes the $
rng2 = Range((rng1),
Range(rng1).End(xlDown)).AddressLocal(RowAbsolute: =False)
rng2 = RemoveChar(rng2) 'function that removes the $
'rng2 is now the string O1:O50

Range(rng2).Select

I now want to apply my range to a range variable Rng.

Rng = range(rng2) - this doesn't work however. Once I've done this I will
use the offset function to add my information.

Any help is greatly appreciated. Could I improve the code above?








All times are GMT +1. The time now is 12:51 PM.

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