a macro which finds last cell in a column

P

pikus

x = the number of the column you are concerned with (column "A" = 1
column "B" = 2 etc.)

last = Worksheets("Sheet1").UsedRange.Row - 1
Worksheets("Sheet1").UsedRange.Rows.Count
Do Until Worksheets("Sheet1").Cells(last, x).Value <> ""
last = last - 1
Loo
 
T

Tom Ogilvy

Dim rng as Range colNum as Long
colNum = 1
set rng = cells(rows.count,colNum).End(xlup)
 
J

Jarek

Note - not typical, but for example (column A):

if the only not empty cell in column A is A65536 (the last row of th
sheet), then xlUp selects the cell A1 (the first row of the sheet)

Jare
 
Top