av8orct

asked on

# Get last column with data from a certain row upwards

I've been trying to get the last column with data in my spreadsheet.

However, what I want to do is to start at a certain row and move upwards. Most of the code I've found looks at the entire spreadsheet.

I am using the below code to find the row to start at:

However, what I want to do is to start at a certain row and move upwards. Most of the code I've found looks at the entire spreadsheet.

I am using the below code to find the row to start at:

```
'need to find last row of data from manifest (not resources)
last_row = Cells.SpecialCells(xlCellTypeLastCell).row
For a = last_row To 1 Step -1
Set current_cell = wksht.Cells(a, 2)
If Len(current_cell.Value) > 0 Then
end_row = a
Exit For
End If
Next a
```

ASKER

ok, but how do I start at (oh lets say) row 87?

doesnt this start from the 'bottom' of the spreadsheet and work backwards?

doesnt this start from the 'bottom' of the spreadsheet and work backwards?

You can experiment with

Dim R As Range

Set R = ActiveSheet.UsedRange

MsgBox (Cells(R.Rows.Count, R.Column).Value)

Dim R As Range

Set R = ActiveSheet.UsedRange

MsgBox (Cells(R.Rows.Count, R.Column).Value)

ASKER CERTIFIED SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

ASKER

that did it, thank you byundt!

lngLastColumn = Cells.Find("*", SearchOrder:=xlByColumns, LookIn:=xlValues, SearchDirection:=xlPreviou