![]() |
using variables with Find
I've written a macro that filters records from a master list of names
and addresses based on specific criteria (on the invitation list for specific fundraisers or to be approached regarding donating to specific campaigns), and then those names and addresses are copied onto a new page for easier viewing. As it stands now, I have a note at the top of the page stating that edits to addresses need to be made on the master page. I tried to record a macro that would take a name from the condensed list and then find it on the master list, but when I use the macro recorder, it records the text of the name ("persons name") I used to record the macro. I'd like it to choose the text from whatever cell the user has chosen before running the macro, OR, I'd like a message box to appear asking for the text to find. Can someone give me some guidance?.. Thanks. My Excel skills are pretty good, but I haven't used VBA in a while and don't quite have a handle on all the codes. Arletta |
using variables with Find
Sub test()
Dim personToFind As String personToFind = InputBox("Enter person to find") Cells.Find(What:=personToFind, After:=ActiveCell, LookIn:=xlFormulas, LookAt _ :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ False, SearchFormat:=False).Activate End Sub "Arle" wrote: I've written a macro that filters records from a master list of names and addresses based on specific criteria (on the invitation list for specific fundraisers or to be approached regarding donating to specific campaigns), and then those names and addresses are copied onto a new page for easier viewing. As it stands now, I have a note at the top of the page stating that edits to addresses need to be made on the master page. I tried to record a macro that would take a name from the condensed list and then find it on the master list, but when I use the macro recorder, it records the text of the name ("persons name") I used to record the macro. I'd like it to choose the text from whatever cell the user has chosen before running the macro, OR, I'd like a message box to appear asking for the text to find. Can someone give me some guidance?.. Thanks. My Excel skills are pretty good, but I haven't used VBA in a while and don't quite have a handle on all the codes. Arletta |
using variables with Find
Thank you so much! I needed to add a reference to the other sheet just
in case they didn't click in the name field to begin with. personToFind = InputBox("Enter name exactly as it appears in column A") Sheets("complete list").Select Range("A1").Select |
All times are GMT +1. The time now is 05:15 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com