Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 41
Default Selecting a Keyword for Macro:

Hello Guys thanks for all the previous help you had offer to me before, i am
in the last step of completing this project and i think is very simple but i
need some help from the experts.

How can i make the Macro to "Find" a specific phrase "always the same Phrase"

and then copy For example 300 cells under that specific phrase.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 703
Default Selecting a Keyword for Macro:

Hi

Look at this:

Sub MyFind()
Dim SearchRng As Range

Set SearchRng = Range("A1:H2")
Set f = SearchRng.Find(what:="Phrase", after:="A1", Lookat:=xlWhole)

If Not f Is Nothing Then
f.Offset(1, 0).Resize(300, 1).Copy
End If
End Sub

Regards,
Per


On 4 Okt., 03:32, Gmata wrote:
Hello Guys thanks for all the previous help you had offer to me before, i am
in the last step of completing this project and i think is very simple but i
need some help from the experts.

How can i make the Macro to "Find" a specific phrase "always the same Phrase"

and then copy For example 300 cells under that specific phrase.

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Selecting a Keyword for Macro:

Sub Macro1()
Dim varFind As Range
Set varFind = Cells.Find(What:="keyword")
If Not varFind Is Nothing Then
varFind.Offset(1, 0).Resize(300, 1).Copy
'do what ever

End If
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Gmata" wrote:

Hello Guys thanks for all the previous help you had offer to me before, i am
in the last step of completing this project and i think is very simple but i
need some help from the experts.

How can i make the Macro to "Find" a specific phrase "always the same Phrase"

and then copy For example 300 cells under that specific phrase.

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 41
Default Selecting a Keyword for Macro:

Is there any way to do it with out actually writing the code, but i just want
to record a Macro, so I just need to know what to press to always go to the
block where that phrase is, because that phrase might be on A100 or A300, so
if i Just click Find and then i typed the phrase the macro gets recorded as
going to a certain cell rather than going to where that Phrase is actually at.

Thans

"Jacob Skaria" wrote:

Sub Macro1()
Dim varFind As Range
Set varFind = Cells.Find(What:="keyword")
If Not varFind Is Nothing Then
varFind.Offset(1, 0).Resize(300, 1).Copy
'do what ever

End If
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Gmata" wrote:

Hello Guys thanks for all the previous help you had offer to me before, i am
in the last step of completing this project and i think is very simple but i
need some help from the experts.

How can i make the Macro to "Find" a specific phrase "always the same Phrase"

and then copy For example 300 cells under that specific phrase.

Thanks

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Selecting a Keyword for Macro:

When you record a macro; MS Excel will automatically generate the code. To
record a macro goto menu

For XL2003 ToolsMacroREcord New MacroOK.

For XL2007: Commands for working with macros and XML are on the Developer
tab, which is displayed only if your turn it on. To display the Developer tab
do the following.
1. Click the Microsoft Office Button, and then click Excel Options
2. Click Popular, and then click Show Developer tab in the Ribbon

As per your requirement mentioned below; the below code will ask for the
search string and if found copy 300 cells down..If you are new to macros..

--Set the Security level to low/medium in (Tools|Macro|Security).
--From workbook launch VBE using short-key Alt+F11.
--From menu 'Insert' a module and paste the below code.
--Get back to Workbook.
--Run macro from Tools|Macro|Run <selected macro()


Sub Macro2()
Dim strSearchString As String, varFind As Range
strSearchString = InputBox("Search String")
Set varFind = Cells.Find(What:=strSearchString)
If Not varFind Is Nothing Then _
varFind.Offset(1, 0).Resize(300, 1).Copy
End Sub


If this post helps click Yes
---------------
Jacob Skaria


"Gmata" wrote:

Is there any way to do it with out actually writing the code, but i just want
to record a Macro, so I just need to know what to press to always go to the
block where that phrase is, because that phrase might be on A100 or A300, so
if i Just click Find and then i typed the phrase the macro gets recorded as
going to a certain cell rather than going to where that Phrase is actually at.

Thans

"Jacob Skaria" wrote:

Sub Macro1()
Dim varFind As Range
Set varFind = Cells.Find(What:="keyword")
If Not varFind Is Nothing Then
varFind.Offset(1, 0).Resize(300, 1).Copy
'do what ever

End If
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Gmata" wrote:

Hello Guys thanks for all the previous help you had offer to me before, i am
in the last step of completing this project and i think is very simple but i
need some help from the experts.

How can i make the Macro to "Find" a specific phrase "always the same Phrase"

and then copy For example 300 cells under that specific phrase.

Thanks



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting a Keyword Gmata Excel Worksheet Functions 3 October 1st 09 10:06 PM
Help with Macro in selecting sheets. Ann New Users to Excel 4 March 30th 07 01:56 PM
Selecting a response on a dialogue box from a Macro ChemicalJasper Excel Discussion (Misc queries) 2 January 4th 07 02:08 PM
Selecting printer in a macro lohme Excel Discussion (Misc queries) 4 January 2nd 07 06:36 PM
Selecting all cells using macro robertlewis Excel Discussion (Misc queries) 3 October 11th 06 10:13 PM


All times are GMT +1. The time now is 01:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"