Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default How do i create a macro using copy

Hi,

I would like to know how do i create a macro the will copy what i have in
cell A1 or inputbox and search it for me.

Eg. Cell A1 consist of text "Apple"

when click on the button, it will find Apple.
If it is "Orange" it will find orange.

I do remember creating it once but have forget about it.

Any advise.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default How do i create a macro using copy

Try

Sub Macro()

Dim varFound As Variant, varSearch As Variant

varSearch = Range("A1")

Set varFound = Cells.Find(varSearch, _
After:=Range("A1"), LookIn:=xlValues, lookat:=xlWhole)
If varFound.Address < "$A$1" Then
varFound.Select
Else
MsgBox "Search string '" & Range("A1") & "' could not be found"
End If

End Sub

--
Jacob (MVP - Excel)


"AndrewT" wrote:

Hi,

I would like to know how do i create a macro the will copy what i have in
cell A1 or inputbox and search it for me.

Eg. Cell A1 consist of text "Apple"

when click on the button, it will find Apple.
If it is "Orange" it will find orange.

I do remember creating it once but have forget about it.

Any advise.

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default How do i create a macro using copy

Thanks.
But is there a way for me input it using the inputbox for search?

"Jacob Skaria" wrote:

Try

Sub Macro()

Dim varFound As Variant, varSearch As Variant

varSearch = Range("A1")

Set varFound = Cells.Find(varSearch, _
After:=Range("A1"), LookIn:=xlValues, lookat:=xlWhole)
If varFound.Address < "$A$1" Then
varFound.Select
Else
MsgBox "Search string '" & Range("A1") & "' could not be found"
End If

End Sub

--
Jacob (MVP - Excel)


"AndrewT" wrote:

Hi,

I would like to know how do i create a macro the will copy what i have in
cell A1 or inputbox and search it for me.

Eg. Cell A1 consist of text "Apple"

when click on the button, it will find Apple.
If it is "Orange" it will find orange.

I do remember creating it once but have forget about it.

Any advise.

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default How do i create a macro using copy

Try

Sub Macro()

Dim varFound As Variant, varSearch As Variant

varSearch = InputBox("Enter search string")

Set varFound = Cells.Find(varSearch, , xlValues, xlWhole)
If Not varFound Is Nothing Then
varFound.Select
Else
MsgBox "Search string '" & varSearch & "' could not be found"
End If

End Sub



--
Jacob (MVP - Excel)


"AndrewT" wrote:

Thanks.
But is there a way for me input it using the inputbox for search?

"Jacob Skaria" wrote:

Try

Sub Macro()

Dim varFound As Variant, varSearch As Variant

varSearch = Range("A1")

Set varFound = Cells.Find(varSearch, _
After:=Range("A1"), LookIn:=xlValues, lookat:=xlWhole)
If varFound.Address < "$A$1" Then
varFound.Select
Else
MsgBox "Search string '" & Range("A1") & "' could not be found"
End If

End Sub

--
Jacob (MVP - Excel)


"AndrewT" wrote:

Hi,

I would like to know how do i create a macro the will copy what i have in
cell A1 or inputbox and search it for me.

Eg. Cell A1 consist of text "Apple"

when click on the button, it will find Apple.
If it is "Orange" it will find orange.

I do remember creating it once but have forget about it.

Any advise.

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
macro to create a new workbook/ macro to copy columns TG Excel Programming 0 September 11th 09 06:55 PM
macro to create, name sheet and copy. sutha Excel Discussion (Misc queries) 4 December 23rd 08 01:53 PM
create a macro to copy a worksheet into another Sean Excel Discussion (Misc queries) 7 October 18th 06 10:19 PM
create macro to copy DTruong Excel Discussion (Misc queries) 0 May 31st 06 03:12 PM
Create a Macro that will copy the rows that have a value < 0 wil4d Excel Discussion (Misc queries) 1 December 18th 05 05:28 PM


All times are GMT +1. The time now is 10:09 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"