ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Find within a file as a function (https://www.excelbanter.com/excel-discussion-misc-queries/48835-find-within-file-function.html)

MACRE0

Find within a file as a function
 

Cell J22 generally contains the text "Project Name:" within a template.
But people mess with their files and this is not always the case. Also
it was not previously defined as Project Name (and since I can't
expect everyone to download a new template, can't be). What I would
like to do is be able to have a seperate file search through the
template to locate this cell and enter the information directly below.
I'm also not allowed to use a macro here. If however a macro is the
only way, I'll take any assistance you can provide. Thank you.


--
MACRE0
------------------------------------------------------------------------
MACRE0's Profile: http://www.excelforum.com/member.php...o&userid=10848
View this thread: http://www.excelforum.com/showthread...hreadid=473546


Dave Peterson

I think you'll need a macro.

Maybe something like:

Option Explicit
Sub testme01()

Dim FoundCell As Range
Dim FindWhat As String

FindWhat = "Project Name:"

With ActiveSheet.UsedRange
Set FoundCell = .Cells.Find(What:=FindWhat, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)

If FoundCell Is Nothing Then
MsgBox "not found"
Else
FoundCell.Offset(1, 0).Value = "someinformationthatyoudidn'tshare"
End If
End With

End Sub

MACRE0 wrote:

Cell J22 generally contains the text "Project Name:" within a template.
But people mess with their files and this is not always the case. Also
it was not previously defined as Project Name (and since I can't
expect everyone to download a new template, can't be). What I would
like to do is be able to have a seperate file search through the
template to locate this cell and enter the information directly below.
I'm also not allowed to use a macro here. If however a macro is the
only way, I'll take any assistance you can provide. Thank you.

--
MACRE0
------------------------------------------------------------------------
MACRE0's Profile: http://www.excelforum.com/member.php...o&userid=10848
View this thread: http://www.excelforum.com/showthread...hreadid=473546


--

Dave Peterson


All times are GMT +1. The time now is 02:22 PM.

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