ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Reverse the order? (https://www.excelbanter.com/excel-programming/333880-reverse-order.html)

davegb

Reverse the order?
 
I got the following code here. It finds the currrent area minus the row
at the bottom (Totals) to be filtered. In one sheet, it doesn't include
a couple of columns because of a blank cell in the bottom row. I
checked, and the top row and last column always have data in all cells.
I've been trying to figure out how to do the same thing but go across
first, then down. But I can't figure it out! Anyone know how to reverse
this?

Set rStart = Range("B4")
lRow = rStart.End(xlDown).Offset(-1, 0).Row
lCol = Cells(lRow, Columns.Count).End(xlToLeft).Column
Set rEnd = Range(rStart, Cells(lRow, lCol))

Thanks for the help!


Tom Ogilvy

Reverse the order?
 
Set rStart = Range("B4")
lCol = rStart.End(xlToRight).Column
lRow = cells(rStart.row,lcol).End(xldown).Row - 1
Set rEnd = Range(rStart, Cells(lRow, lCol))

--
Regards,
Tom Ogilvy


"davegb" wrote in message
oups.com...
I got the following code here. It finds the currrent area minus the row
at the bottom (Totals) to be filtered. In one sheet, it doesn't include
a couple of columns because of a blank cell in the bottom row. I
checked, and the top row and last column always have data in all cells.
I've been trying to figure out how to do the same thing but go across
first, then down. But I can't figure it out! Anyone know how to reverse
this?

Set rStart = Range("B4")
lRow = rStart.End(xlDown).Offset(-1, 0).Row
lCol = Cells(lRow, Columns.Count).End(xlToLeft).Column
Set rEnd = Range(rStart, Cells(lRow, lCol))

Thanks for the help!




davegb

Reverse the order?
 
Worked great! Thanks Tom.

Tom Ogilvy wrote:
Set rStart = Range("B4")
lCol = rStart.End(xlToRight).Column
lRow = cells(rStart.row,lcol).End(xldown).Row - 1
Set rEnd = Range(rStart, Cells(lRow, lCol))

--
Regards,
Tom Ogilvy


"davegb" wrote in message
oups.com...
I got the following code here. It finds the currrent area minus the row
at the bottom (Totals) to be filtered. In one sheet, it doesn't include
a couple of columns because of a blank cell in the bottom row. I
checked, and the top row and last column always have data in all cells.
I've been trying to figure out how to do the same thing but go across
first, then down. But I can't figure it out! Anyone know how to reverse
this?

Set rStart = Range("B4")
lRow = rStart.End(xlDown).Offset(-1, 0).Row
lCol = Cells(lRow, Columns.Count).End(xlToLeft).Column
Set rEnd = Range(rStart, Cells(lRow, lCol))

Thanks for the help!




All times are GMT +1. The time now is 03:38 AM.

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