Discussion Locked

function that will return a cell referen

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Is there a function (something like Vlookup) that will return the cell reference of a cell that I'm looking for?

I need to find the last line on several worksheets and then instert some data and adjust some formulas.

5 replies

by roc180

Within Excel if you want to find the last row that has data you will need to write a macro that will walk down a column evaluating the data until you come to the cell you are looking for, check out the ActiveCell property of the worksheet. If the cell you want is in the same place every time then your life is a lot easier you can use the Range or Cell property of the worksheet. The below code is an example of a macro used to walk down a column evaluating each cell and Capitalizing the contents of the cell:

Sub Set_Cap()
Dim intC As Integer

ActiveSheet.Range("A1").Select

intC = 1
While intC = 1
ActiveCell.Value = UCase(ActiveCell.Value)
ActiveCell.Offset(1, 0).Select 'Down 1
If ActiveCell = "" Then 'No More Data
intC = 2
End If
Wend

MsgBox "Done"

End Sub

If you have any other questions let me know.

Good Luck

Neal Martinelli

by leaslynn

The easiest way to go to the last row is Ctrl+End, which will take you to the last cell in the sheet.

This discussion is closed to new replies.