excel: usedrange with columns of table

Viewed 1761

Is there any way to use UsedRange to select from first to last column from a table?

Here is the original code:

Worksheets("Sheet1").UsedRange.Columns("E").Cells

But it gets from first row to last maximum of Excel and I don't want this. So I tried to do something like this:

Dim LastRow As Integer
    Dim ws As Worksheet

Set ws = Worksheets("Sheet1")
  LastRow = ws.Cells(Rows.Count, 1).End(xlUp).Row  

With ws.UsedRange.Columns("E2:E & LastRow").Cells

Although this doesn't seem to work here, so I was in doubt if there is a correct way to do this or the UsedRange it's not the best for that.

In addition, after this I want to use THIS code provided by Jeeped, but I need to know if it's possible to solve this problem first.

2 Answers
Related