ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   find and scroll to cell string value in Excel (https://www.excelbanter.com/excel-programming/449745-find-scroll-cell-string-value-excel.html)

[email protected]

find and scroll to cell string value in Excel
 
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!

Claus Busch

find and scroll to cell string value in Excel
 
Hi,

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

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.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2

[email protected]

find and scroll to cell string value in Excel
 
On Saturday, January 25, 2014 2:34:35 AM UTC-8, Claus Busch wrote:
Hi,



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



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.

--

Win XP PRof SP2 / Vista Ultimate SP2

Office 2003 SP2 /2007 Ultimate SP2


Wonderful! Thank you!


All times are GMT +1. The time now is 06:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com