• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Select row and column, from to the last data

Visor

Member
Dear friends, greetings, as it should make for a selected range of cells but particularly to and from the last row with data, whatever the data column since columns have variable number of data
I appreciate your cooperation in advance
 

Attachments

  • Seleccion hasta la ulitma fila y columna con datos.rar
    13.9 KB · Views: 3
Hi:

May Be something like this
Code:
i& = Hoja1.Cells(Rows.Count, "A").End(xlUp).Row
Range("A3:I" & i).Select

Thanks
 
Greetings, thank,... the macro that you have sent me, pick up the last column with data but not until the last row with data, look at it !!
upload_2016-4-11_10-0-58.png
Note: Any column can generate the last row with data
 
Thanks Marc L, but for example this:

Hoja1.UsedRange.Select

It includes headers, which are in row 2, which do not want to delete

as I exclude row 2?
 
Hi:
As Marc L mentioned use used range
Code:
With ActiveSheet.UsedRange
        i& = .Rows(.Rows.Count).Row
End With
Range("A3:I" & i).Select

Thanks
 
Hi:

The reason why it is selecting till column I is because I had hard coded it. Assuming that your column A will always have data here is an alternate code.

This will select the range if there is headers in your example till column H , if you want to select only till column G delete the header in column H

Code:
With ActiveSheet.UsedRange
        i& = .Rows(.Rows.Count).Row
        j& = .Columns(.Columns.Count).Column
End With
Range(Cells(3, 1), Cells(i, j)).Select

Thanks
 
Back
Top