find and scroll to cell string value in Excel

E

excel5336

I am trying to program a simple button in Excel to "jump" to a specific Title cell. However, because this worksheet will have rows added and deleted, moved about, this title cell must be programmed by the string (Title) within it, not the cell alpha+number.

Seems so simple, yet I cannot find the syntax for finding a cell by string and then going to that cell.

Thank you in advance for any help!
 
C

Claus Busch

Hi,

Am Sat, 25 Jan 2014 02:18:13 -0800 (PST) schrieb (e-mail address removed):
I am trying to program a simple button in Excel to "jump" to a specific Title cell. However, because this worksheet will have rows added and deleted, moved about, this title cell must be programmed by the string (Title) within it, not the cell alpha+number.

Seems so simple, yet I cannot find the syntax for finding a cell by string and then going to that cell.

try:

Sub FindString()
Dim c As Range
Dim myStr As String

myStr = "Test"
With ActiveSheet
Set c = .UsedRange.Find(myStr, _
LookIn:=xlValues, lookat:=xlWhole)
If Not c Is Nothing Then Application.Goto c, 1
End With
End Sub


Regards
Claus B.
 
E

excel5336

Hi,



Am Sat, 25 Jan 2014 02:18:13 -0800 (PST) schrieb (e-mail address removed):






try:



Sub FindString()

Dim c As Range

Dim myStr As String



myStr = "Test"

With ActiveSheet

Set c = .UsedRange.Find(myStr, _

LookIn:=xlValues, lookat:=xlWhole)

If Not c Is Nothing Then Application.Goto c, 1

End With

End Sub





Regards

Claus B.

--

Win XP PRof SP2 / Vista Ultimate SP2

Office 2003 SP2 /2007 Ultimate SP2

Wonderful! Thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top