how find first cell

Forum home » Delegate support and help forum » Microsoft VBA Training and help » How to find first cell with text

How to find first cell with text

resolvedResolved · Medium Priority · Version 2003

Adriana has attended:
Excel VBA Intro Intermediate course

How to find first cell with text

How can I find the address of the first cell with Text in Column A starting from A1 using Ctl and Arrow down?

RE: How to find first cell with text

Hi Adriana

Sorry for the delay

To find the address of the first cell with text in Column A you can use the following code:

Sub FindCellAddress()

Dim CellAddress As String

Range("A1").End(xlDown).Select 'Selects the first cell in ColumnA with text
CellAddress = ActiveCell.Address 'Saves the address as a string in the variable

MsgBox CellAddress 'View the saved address

End Sub


Hope this helps

Carlos

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

VBA tip:

Use VbNullString instead of

When needing to default a String variable back to it's default of "" use vbNullString as in the following example:

Sub ClearText()

Dim strEmpName As String

strEmpName = "John Smith"
MsgBox strEmpName

strEmpName = vbNullString
MsgBox strEmpName

End Sub

View all VBA hints and tips


Server loaded in 0.06 secs.