Sorry but this is very vague.Originally Posted by tjolley
Can you try to explain exactly what it is you are trying to do ?
Example at bottom....
Is there anyway to do this by row until is comes to the empty row, the reason being is when I only have one row instead of many it End(xldown)into my other data...which then it is no good.
I was just trying to get it to select by row until it comes to the blank row, instead of by region like it is...
Anyhelp is greatly appreciated!
Not sure if it will work but give this a try:
Note - This may select rows above your selection, and will select all columns of data.VB:Selection.CurrentRegion.Select
If you only want the first column, you can adjust by:
If you don't want rows above the current selection, we could tweak. Post back if this is the case.VB:selection.currentregion.Columns(1).Select
Hope this helps
Not vague at all! No Problem
This line of Code works great...Selection.CurrentRegion.Select
Ionly have one problem....I selected the first 36 columns and some columns are empty...and with the current line of code it selects the region upto the empty column...
Is there a way to keep my 36 columns and then select the Region?
Thank you all for your help too!
Instead of XLDOWN, try using XLUP
i.e from row 65536, define the last row as say
This gets you around the issue of having the first blank row "on the way down" returned as your "last row" - if it's the column that is the issue, you could start with column IV andVB:myrow = cells(65536,1).End(xlup).Row
VB:mycol = cells(1,256).End(xltoleft).column
Humm...thats sounds good...unfortunatly because I'm not very good at explaining things, that won't work in this particular delima
Can we do the following example but -1?
Sorry to be such a pain!
Well you said it!Originally Posted by tjolley
I really have no idea what your problem is given your attempts to explain it thus far. My last post was a "guess" at what the issue might be, but now you've totally lost me
Any way you might be able to attach an example with an explanation of what is happening versus what you want to happen ideally..... remember that we can't see your issue unless you either explain it well or attach it...
I'll be offline now for a bit but may chack back later.
my guess is you are trying to select to the last 2nd last non empty row ?Originally Posted by tjolley
ie select a range until the last row -1 row?
Try this -
This grabs everything from the 1st cell in the current region to the last row, 36th column of the current region (or technically 35 columns from the beginning of the current region.VB:Dim RCount As Long RCount = Selection.CurrentRegion.Rows.Count Range(Selection.CurrentRegion, Selection.CurrentRegion.Cells(RCount, 1).Offset(0, 35)).Select
This isn't perfect, as if you click on an empty cell, it will select that + 35 other cells in that row, but I think it might work for your problem. Post back with more questions.
WillR - I think the confusion is that tjolley has additional data below this data set that is unrelated and he doesn't want selected. That is why the End(xlup) method won't work (it runs into this other data). That's why I used the current region approach instead.
There are currently 1 users browsing this thread. (0 members and 1 guests)