PC Review


Reply
Thread Tools Rate Thread

Can I create a macro that works like the "find' function

 
 
=?Utf-8?B?ZG9yYWw=?=
Guest
Posts: n/a
 
      22nd Aug 2007
What I want to do is have a drop down list of names. After selected I would
like the macro to sort the various other sheets for the variable selected.
Is there a way to build a macro like this? Thank you.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?Q2hhZA==?=
Guest
Posts: n/a
 
      22nd Aug 2007
I'm not sure if you're simply looking for 'find' feautre, try this:

texttofind = "blah blah blah" ' or whatever you're passing in to search for

Cells.Find(What:=texttofind, After:=ActiveCell, LookIn:=xlFormulas,
LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate

Hope this helps,
Chad

"doral" wrote:

> What I want to do is have a drop down list of names. After selected I would
> like the macro to sort the various other sheets for the variable selected.
> Is there a way to build a macro like this? Thank you.

 
Reply With Quote
 
=?Utf-8?B?ZG9yYWw=?=
Guest
Posts: n/a
 
      23rd Aug 2007
This didn't work. What I want to do say. I have a list a through d on first
sheet. Then I have 4 other sheets with a on one, b on one, etc to d. I want
to select from a drop down list a letter, say d, then have a textbox with a
macro assigned to it which would then find that letter in the other 4 sheets
(a through d). So after you would run the macro, it would go to sheet d.

"Chad" wrote:

> I'm not sure if you're simply looking for 'find' feautre, try this:
>
> texttofind = "blah blah blah" ' or whatever you're passing in to search for
>
> Cells.Find(What:=texttofind, After:=ActiveCell, LookIn:=xlFormulas,
> LookAt _
> :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
> MatchCase:= _
> False, SearchFormat:=False).Activate
>
> Hope this helps,
> Chad
>
> "doral" wrote:
>
> > What I want to do is have a drop down list of names. After selected I would
> > like the macro to sort the various other sheets for the variable selected.
> > Is there a way to build a macro like this? Thank you.

 
Reply With Quote
 
=?Utf-8?B?Q2hhZA==?=
Guest
Posts: n/a
 
      23rd Aug 2007
Use code similar to the following for the listbox.

Private Sub ListBox1_Click()
gotosheet = ListBox1.Value
Sheets(gotosheet).Select
End Sub

Hope this helps,
Chad

"doral" wrote:

> This didn't work. What I want to do say. I have a list a through d on first
> sheet. Then I have 4 other sheets with a on one, b on one, etc to d. I want
> to select from a drop down list a letter, say d, then have a textbox with a
> macro assigned to it which would then find that letter in the other 4 sheets
> (a through d). So after you would run the macro, it would go to sheet d.
>
> "Chad" wrote:
>
> > I'm not sure if you're simply looking for 'find' feautre, try this:
> >
> > texttofind = "blah blah blah" ' or whatever you're passing in to search for
> >
> > Cells.Find(What:=texttofind, After:=ActiveCell, LookIn:=xlFormulas,
> > LookAt _
> > :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
> > MatchCase:= _
> > False, SearchFormat:=False).Activate
> >
> > Hope this helps,
> > Chad
> >
> > "doral" wrote:
> >
> > > What I want to do is have a drop down list of names. After selected I would
> > > like the macro to sort the various other sheets for the variable selected.
> > > Is there a way to build a macro like this? Thank you.

 
Reply With Quote
 
=?Utf-8?B?ZG9yYWw=?=
Guest
Posts: n/a
 
      23rd Aug 2007
I must be doing something wrong, because it is not working at all. Keep
getting an object required error.

"Chad" wrote:

> Use code similar to the following for the listbox.
>
> Private Sub ListBox1_Click()
> gotosheet = ListBox1.Value
> Sheets(gotosheet).Select
> End Sub
>
> Hope this helps,
> Chad
>
> "doral" wrote:
>
> > This didn't work. What I want to do say. I have a list a through d on first
> > sheet. Then I have 4 other sheets with a on one, b on one, etc to d. I want
> > to select from a drop down list a letter, say d, then have a textbox with a
> > macro assigned to it which would then find that letter in the other 4 sheets
> > (a through d). So after you would run the macro, it would go to sheet d.
> >
> > "Chad" wrote:
> >
> > > I'm not sure if you're simply looking for 'find' feautre, try this:
> > >
> > > texttofind = "blah blah blah" ' or whatever you're passing in to search for
> > >
> > > Cells.Find(What:=texttofind, After:=ActiveCell, LookIn:=xlFormulas,
> > > LookAt _
> > > :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
> > > MatchCase:= _
> > > False, SearchFormat:=False).Activate
> > >
> > > Hope this helps,
> > > Chad
> > >
> > > "doral" wrote:
> > >
> > > > What I want to do is have a drop down list of names. After selected I would
> > > > like the macro to sort the various other sheets for the variable selected.
> > > > Is there a way to build a macro like this? Thank you.

 
Reply With Quote
 
=?Utf-8?B?Q2hhZA==?=
Guest
Posts: n/a
 
      23rd Aug 2007
In my example, the sheets are named a, b, c, etc. Is this how you're
workbook is organized, or is there something that differs?

"doral" wrote:

> I must be doing something wrong, because it is not working at all. Keep
> getting an object required error.
>
> "Chad" wrote:
>
> > Use code similar to the following for the listbox.
> >
> > Private Sub ListBox1_Click()
> > gotosheet = ListBox1.Value
> > Sheets(gotosheet).Select
> > End Sub
> >
> > Hope this helps,
> > Chad
> >
> > "doral" wrote:
> >
> > > This didn't work. What I want to do say. I have a list a through d on first
> > > sheet. Then I have 4 other sheets with a on one, b on one, etc to d. I want
> > > to select from a drop down list a letter, say d, then have a textbox with a
> > > macro assigned to it which would then find that letter in the other 4 sheets
> > > (a through d). So after you would run the macro, it would go to sheet d.
> > >
> > > "Chad" wrote:
> > >
> > > > I'm not sure if you're simply looking for 'find' feautre, try this:
> > > >
> > > > texttofind = "blah blah blah" ' or whatever you're passing in to search for
> > > >
> > > > Cells.Find(What:=texttofind, After:=ActiveCell, LookIn:=xlFormulas,
> > > > LookAt _
> > > > :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
> > > > MatchCase:= _
> > > > False, SearchFormat:=False).Activate
> > > >
> > > > Hope this helps,
> > > > Chad
> > > >
> > > > "doral" wrote:
> > > >
> > > > > What I want to do is have a drop down list of names. After selected I would
> > > > > like the macro to sort the various other sheets for the variable selected.
> > > > > Is there a way to build a macro like this? Thank you.

 
Reply With Quote
 
=?Utf-8?B?ZG9yYWw=?=
Guest
Posts: n/a
 
      23rd Aug 2007
Yes, but I don't think I'm assigning the macro correctly. This is what I
did. a1=a, a2=b, a3=c, a4=d. Then I went data, validate and made a drop
down list in c1 with the values a through d. So how do I get that macro to
run off the drop down? Thanks

"Chad" wrote:

> In my example, the sheets are named a, b, c, etc. Is this how you're
> workbook is organized, or is there something that differs?
>
> "doral" wrote:
>
> > I must be doing something wrong, because it is not working at all. Keep
> > getting an object required error.
> >
> > "Chad" wrote:
> >
> > > Use code similar to the following for the listbox.
> > >
> > > Private Sub ListBox1_Click()
> > > gotosheet = ListBox1.Value
> > > Sheets(gotosheet).Select
> > > End Sub
> > >
> > > Hope this helps,
> > > Chad
> > >
> > > "doral" wrote:
> > >
> > > > This didn't work. What I want to do say. I have a list a through d on first
> > > > sheet. Then I have 4 other sheets with a on one, b on one, etc to d. I want
> > > > to select from a drop down list a letter, say d, then have a textbox with a
> > > > macro assigned to it which would then find that letter in the other 4 sheets
> > > > (a through d). So after you would run the macro, it would go to sheet d.
> > > >
> > > > "Chad" wrote:
> > > >
> > > > > I'm not sure if you're simply looking for 'find' feautre, try this:
> > > > >
> > > > > texttofind = "blah blah blah" ' or whatever you're passing in to search for
> > > > >
> > > > > Cells.Find(What:=texttofind, After:=ActiveCell, LookIn:=xlFormulas,
> > > > > LookAt _
> > > > > :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
> > > > > MatchCase:= _
> > > > > False, SearchFormat:=False).Activate
> > > > >
> > > > > Hope this helps,
> > > > > Chad
> > > > >
> > > > > "doral" wrote:
> > > > >
> > > > > > What I want to do is have a drop down list of names. After selected I would
> > > > > > like the macro to sort the various other sheets for the variable selected.
> > > > > > Is there a way to build a macro like this? Thank you.

 
Reply With Quote
 
=?Utf-8?B?Q2hhZA==?=
Guest
Posts: n/a
 
      23rd Aug 2007
I'm not sure how to do it with a drop down list like that, but I'd use a
combo box or list box. Then, you can use the code I listed earlier.


"doral" wrote:

> Yes, but I don't think I'm assigning the macro correctly. This is what I
> did. a1=a, a2=b, a3=c, a4=d. Then I went data, validate and made a drop
> down list in c1 with the values a through d. So how do I get that macro to
> run off the drop down? Thanks
>
> "Chad" wrote:
>
> > In my example, the sheets are named a, b, c, etc. Is this how you're
> > workbook is organized, or is there something that differs?
> >
> > "doral" wrote:
> >
> > > I must be doing something wrong, because it is not working at all. Keep
> > > getting an object required error.
> > >
> > > "Chad" wrote:
> > >
> > > > Use code similar to the following for the listbox.
> > > >
> > > > Private Sub ListBox1_Click()
> > > > gotosheet = ListBox1.Value
> > > > Sheets(gotosheet).Select
> > > > End Sub
> > > >
> > > > Hope this helps,
> > > > Chad
> > > >
> > > > "doral" wrote:
> > > >
> > > > > This didn't work. What I want to do say. I have a list a through d on first
> > > > > sheet. Then I have 4 other sheets with a on one, b on one, etc to d. I want
> > > > > to select from a drop down list a letter, say d, then have a textbox with a
> > > > > macro assigned to it which would then find that letter in the other 4 sheets
> > > > > (a through d). So after you would run the macro, it would go to sheet d.
> > > > >
> > > > > "Chad" wrote:
> > > > >
> > > > > > I'm not sure if you're simply looking for 'find' feautre, try this:
> > > > > >
> > > > > > texttofind = "blah blah blah" ' or whatever you're passing in to search for
> > > > > >
> > > > > > Cells.Find(What:=texttofind, After:=ActiveCell, LookIn:=xlFormulas,
> > > > > > LookAt _
> > > > > > :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
> > > > > > MatchCase:= _
> > > > > > False, SearchFormat:=False).Activate
> > > > > >
> > > > > > Hope this helps,
> > > > > > Chad
> > > > > >
> > > > > > "doral" wrote:
> > > > > >
> > > > > > > What I want to do is have a drop down list of names. After selected I would
> > > > > > > like the macro to sort the various other sheets for the variable selected.
> > > > > > > Is there a way to build a macro like this? Thank you.

 
Reply With Quote
 
=?Utf-8?B?ZG9yYWw=?=
Guest
Posts: n/a
 
      23rd Aug 2007
I will try this, but I can't get my values of a through d into the combo box.

"Chad" wrote:

> I'm not sure how to do it with a drop down list like that, but I'd use a
> combo box or list box. Then, you can use the code I listed earlier.
>
>
> "doral" wrote:
>
> > Yes, but I don't think I'm assigning the macro correctly. This is what I
> > did. a1=a, a2=b, a3=c, a4=d. Then I went data, validate and made a drop
> > down list in c1 with the values a through d. So how do I get that macro to
> > run off the drop down? Thanks
> >
> > "Chad" wrote:
> >
> > > In my example, the sheets are named a, b, c, etc. Is this how you're
> > > workbook is organized, or is there something that differs?
> > >
> > > "doral" wrote:
> > >
> > > > I must be doing something wrong, because it is not working at all. Keep
> > > > getting an object required error.
> > > >
> > > > "Chad" wrote:
> > > >
> > > > > Use code similar to the following for the listbox.
> > > > >
> > > > > Private Sub ListBox1_Click()
> > > > > gotosheet = ListBox1.Value
> > > > > Sheets(gotosheet).Select
> > > > > End Sub
> > > > >
> > > > > Hope this helps,
> > > > > Chad
> > > > >
> > > > > "doral" wrote:
> > > > >
> > > > > > This didn't work. What I want to do say. I have a list a through d on first
> > > > > > sheet. Then I have 4 other sheets with a on one, b on one, etc to d. I want
> > > > > > to select from a drop down list a letter, say d, then have a textbox with a
> > > > > > macro assigned to it which would then find that letter in the other 4 sheets
> > > > > > (a through d). So after you would run the macro, it would go to sheet d.
> > > > > >
> > > > > > "Chad" wrote:
> > > > > >
> > > > > > > I'm not sure if you're simply looking for 'find' feautre, try this:
> > > > > > >
> > > > > > > texttofind = "blah blah blah" ' or whatever you're passing in to search for
> > > > > > >
> > > > > > > Cells.Find(What:=texttofind, After:=ActiveCell, LookIn:=xlFormulas,
> > > > > > > LookAt _
> > > > > > > :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
> > > > > > > MatchCase:= _
> > > > > > > False, SearchFormat:=False).Activate
> > > > > > >
> > > > > > > Hope this helps,
> > > > > > > Chad
> > > > > > >
> > > > > > > "doral" wrote:
> > > > > > >
> > > > > > > > What I want to do is have a drop down list of names. After selected I would
> > > > > > > > like the macro to sort the various other sheets for the variable selected.
> > > > > > > > Is there a way to build a macro like this? Thank you.

 
Reply With Quote
 
=?Utf-8?B?ZG9yYWw=?=
Guest
Posts: n/a
 
      23rd Aug 2007
Or even a list box, but I'd rather have a combo, since it is like a drop down.

"Chad" wrote:

> I'm not sure how to do it with a drop down list like that, but I'd use a
> combo box or list box. Then, you can use the code I listed earlier.
>
>
> "doral" wrote:
>
> > Yes, but I don't think I'm assigning the macro correctly. This is what I
> > did. a1=a, a2=b, a3=c, a4=d. Then I went data, validate and made a drop
> > down list in c1 with the values a through d. So how do I get that macro to
> > run off the drop down? Thanks
> >
> > "Chad" wrote:
> >
> > > In my example, the sheets are named a, b, c, etc. Is this how you're
> > > workbook is organized, or is there something that differs?
> > >
> > > "doral" wrote:
> > >
> > > > I must be doing something wrong, because it is not working at all. Keep
> > > > getting an object required error.
> > > >
> > > > "Chad" wrote:
> > > >
> > > > > Use code similar to the following for the listbox.
> > > > >
> > > > > Private Sub ListBox1_Click()
> > > > > gotosheet = ListBox1.Value
> > > > > Sheets(gotosheet).Select
> > > > > End Sub
> > > > >
> > > > > Hope this helps,
> > > > > Chad
> > > > >
> > > > > "doral" wrote:
> > > > >
> > > > > > This didn't work. What I want to do say. I have a list a through d on first
> > > > > > sheet. Then I have 4 other sheets with a on one, b on one, etc to d. I want
> > > > > > to select from a drop down list a letter, say d, then have a textbox with a
> > > > > > macro assigned to it which would then find that letter in the other 4 sheets
> > > > > > (a through d). So after you would run the macro, it would go to sheet d.
> > > > > >
> > > > > > "Chad" wrote:
> > > > > >
> > > > > > > I'm not sure if you're simply looking for 'find' feautre, try this:
> > > > > > >
> > > > > > > texttofind = "blah blah blah" ' or whatever you're passing in to search for
> > > > > > >
> > > > > > > Cells.Find(What:=texttofind, After:=ActiveCell, LookIn:=xlFormulas,
> > > > > > > LookAt _
> > > > > > > :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
> > > > > > > MatchCase:= _
> > > > > > > False, SearchFormat:=False).Activate
> > > > > > >
> > > > > > > Hope this helps,
> > > > > > > Chad
> > > > > > >
> > > > > > > "doral" wrote:
> > > > > > >
> > > > > > > > What I want to do is have a drop down list of names. After selected I would
> > > > > > > > like the macro to sort the various other sheets for the variable selected.
> > > > > > > > Is there a way to build a macro like this? Thank you.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find "Last Friday" function works almost 100% Juan Correa Microsoft Access VBA Modules 10 10th Sep 2009 09:17 PM
Macro with "relative" range for Average function, or... 'is there a real keystroke recording macro generator? jss Microsoft Excel Discussion 3 10th Jun 2009 01:46 AM
Macro works, identical Function doesn't....why? =?Utf-8?B?UGF1bCBT?= Microsoft Excel Programming 4 12th Sep 2005 11:46 AM
Macro Works, Function or Sub with Parameters doesnt. Suggestions Please. Andy Kveps Microsoft Excel Programming 4 11th Aug 2004 11:17 PM
Use ComboBox to create a function which like the "find in files" of VS .Net =?Utf-8?B?amFtZXMgb3U=?= Microsoft Dot NET Framework Forms 0 9th Feb 2004 06:31 AM


Features
 

Advertising
 

Newsgroups
 


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