How do I write a macro that would look for a string in an entire column

how do I write a macro that would look for a string in an entire column. If the string is found, it will copy that entire row to a new sheet in that same file?
I want to look in an entire column lets say "C" for different strings of numbers like 246, 88, 68, 82246 etc... and copy them to a new sheet
Thanks

Hello Larbec,
Try this:
Option Explicit
Sub test()
    Dim myNumber As Integer
    Dim myNumbers() As Integer
    Dim i As Integer
    Dim c As Range
    Dim firstAddress As Variant
    myNumbers = Array(246, 88, 68, 82246)
    For i = 0 To UBound(myNumbers)
        myNumber = myNumbers(i)
        With ActiveSheet.Range("C:C")
            Set c = .Find(myNumber, LookIn:=xlValues)
            If Not c Is Nothing Then
                firstAddress = c.Address
                Do
    ' Copy c.value to OtherSheet here !!!!
                    Set c = .FindNext(c)
                Loop While Not c Is Nothing And c.Address <> firstAddress
            End If
        End With
    Next i
End Sub
Best regards George

Similar Messages

  • Can I write a macro that will extract pages

    I'm pretty good at using Microsoft's VBA for writing macros in Excel.  I'm wondering if Acrobat has anything similar to manipulate pdf files.  My company has a lot of PDFs that we want to split up into small documents.  I'd like to be able to write a script that would look for certain text, then based the page where it found the text, it would extract a range of pages into a new document.  Think of it as taking a book and having the macro break it up into chapters so each chapter would be it's own PDF file.  Even better would be for the macro to do this to all files in a folder.  Is something like this possible in Acrobat?

    It's possible with JavaScript. JavaScript can be using in a batch sequence (aka Action), to deal with a collection of documents.
    Here are the basic methods you'd use:
    doc.extractpages: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.465.html
    doc.getNthPageWord: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.486.html
    doc.getPageNumWords: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.488.html

  • Can anyone help me write a script that would click "get info" and then "enter" on each movie in my itunes library? I am asking because my itunes 11 repeatedly loses the artwork to my movies in my itunes library.

    Can anyone help me write a script that would click "get info" and then "enter" on each movie in my itunes library? I am asking because my itunes 11 repeatedly loses the artwork to my movies in my itunes library. I can restore the artwork (and make my apple tv see the movie exists as well) by going into the movie library and clicking on each movie by hand, slecting get info, and then selecting enter. Now doing this 10 times in 20 days was fun and all BUT I would really like to automate the process so everytime itunes screws it up I can fix it easier.
    I saw this example of an itunes script that restores artwork for music
    tell application "iTunes" set theSelection to selection repeat with i from 1 to count of theSelection tell (item i of theSelection) set artworkCount to count of artwork repeat artworkCount times set theArtwork to data of artwork 1 delete artwork 1 set data of artwork artworkCount to theArtwork end repeat end tell end repeat end tell
    but I need to tweak this to fit my needs for simply clicking the "get info" button and "enter" in the movie library rather than all the stuff this guy has listed. Any ideas or help on writing this? Thanks.

    Try assigning Queen as the Album Artist on the compilations in iTunes on your computer.

  • How do I find corrupt file that would be disallowing proper exporting of movie?

    How do I find corrupt file that would be disallowing proper exporting of movie?

    I usually start by exporting to AME (as opposed to encoding "in-process" by clicking Export in the Export Settings dialog). Then watch the preview in AME's Encoding panel to see where it chokes. Adding an adjustment layer over the whole sequence with the Timecode effect applied--and scaled up to full frame width--can really help isolate the location.
    That approach can be a pain in cases where it chugs away for a long time before encoding fails. In those cases, I use a divide-and-conquer approach:
    Is it the video or the audio?: Disable all video tracks and encode. Then re-enable the video and mute all audio tracks
    Where in the timeline is the problem: Export the first half, then the second half (using In/Out Points). Then keep dividing the half that fails until you've narrowed it down to a relative handful of clips.

  • Write a program that would schedule another program in background multipul

    Hi All,
              I need to write a program that would schedule another program in background multipul times according to input we provided on different application servers.
    For ex:- In  table FKKVKP, i am having 2.1 millons contract accounts. I need to write a program(A) that should take 5000 contract accounts at a time as a input and schedule another program(B) in background with input of 5000 contract accounts. And program A ,again schedule program B on differrent application servers , till 2.1 millions contract accounts get used.
    Thanx in advance.
    Regards,
    Dilip Kushwah

    hi,
    1) Carry out the recording for the required transaction using SHDB.
    2) Use batch input method to create session this is done by three FMs
    bdc: open_group, bdc_insert, close_group.
    3) A session is created , which can be seen in transaction SM 35.
    4) Use the standard program RSBDCSUB to configure the session created in SM35.
    This way you can achieve your requirement.
    Check this links too for more information
    Batch input [http://help.sap.com/saphelp_nw04/helpdata/en/fa/097015543b11d1898e0000e8322d00/frameset.htm]
    [http://help.sap.com/saphelp_nw04/helpdata/en/4c/4c0e8a725311d396a80004ac96334b/frameset.htm]
    [http://help.sap.com/saphelp_nw04/helpdata/en/4c/4c0e8a725311d396a80004ac96334b/content.htm]
    Thanks
    Sharath

  • How can I get the apps that I paid for on iTunes and the app store I don't have a computer I paid for them using my ipad and everytime I try to redownload them it asks for my card number and when I put the number in it tells me that the number is not a wo

    Ok can anyone tell how I can get the apps that I paid for on iTunes and the app store using my I pad because I don't have a computer and when I try to redownload the apps it keeps asking me for my card number and when I give it my card info it says that it's an invalid number when I know that it's not

    If you are getting an 'invalid security code' message then is the address on your iTunes account exactly the same (format and spacing etc) as on your credit card bill : http://support.apple.com/kb/TS1646 ? If it is then you could try what it says at the bottom of that page :
    If the issue persists, contact your credit card company and verify that they and any company they use to process credit card authorizations have the correct information on file.
    And/or try contacting iTunes support : http://www.apple.com/support/itunes/contact/ - click on Express Lane, then iTunes > iTunes Store

  • I have brought a 17'' MacBook Pro 2.5ghz core 2 duo 2gb. Model A1261. It seems I can upgrade to either 8gb or 16gb ram! But since It's 2006'ish, I just want some advice on the best ram that would work for a good price. Thanks :)

    I have brought a 17'' MacBook Pro 2.5ghz core 2 duo 2gb. Model A1261. It seems I can upgrade to either 8gb or 16gb ram! But since It's 2006'ish, I just want some advice on the best ram that would work for a good price. Thanks :)

    Keiran420 wrote:
    8 gb will do I guess
    Based on the information that you have supplied, you have a Early or Late 2008 MBP.  Maximum RAM that it will accept is 6 GB with the following specifications:   200-pin PC2-5300 (667MHz) DDR2 SO-DIMM.
    The best sources for Mac compatible RAM are OWC and Crucial.
    Ciao.

  • TS1702 How do I get an app that I paid for transferred over to my iPhone? I paid for it and its not able to be used on iPad!

    How do I get an app that I paid for transferred over to my iPhone? I paid for it and its not able to be used on iPad!

    Assuming you're using the same Apple ID, just download it onto your iPhone.

  • HT4479 How do i retrieve a passcode that i set for my ipad?

    How do i retrieve a passcode that i set for my ipad?

    You can't. If you don't remember it then you have to reset the iPad. This will erase everything on the device before restoring iOS. If you synced recently with iTunes, then you can restore from the most recent backup.
    iTunes 10 for Mac- Update and restore software on iPod, iPhone, or iPad

  • How can I launch a site that I designed for a client using their MobileMe account? Can they 'open' my iWeb files on their iWeb software?

    How can I launch a site that I designed for a client using their MobileMe account? Can they 'open' my iWeb files on their iWeb software?

    If you give them the Domain.sites2 file that iWeb used to create the site  they will be able to open it with iWeb application (it has to be the same version as you have) and make changes.  But if you're expected to also make changes you'll need a way to send that file back and forth between the two. 
    Also there's an online MacWorld article that describes a way that both of you could manage the site using Dropbox.  Look at Managing an iWeb site from multiple Macs.
    OT

  • Hi I'm trying to buy the £26 a month adobe subscription but when I enter my serial number it says I'm not eligible for this offer. I purchased CS4 so thought that would qualify for eligibility?

    Hi I'm trying to buy the £26 a month adobe subscription but when I enter my serial number it says I'm not eligible for this offer. I purchased CS4 so thought that would qualify for eligibility.
    Does anyone have an idea why the product I purchased (CS4) is not eligible?

    Hi Louise,
    Is your CS4 serial number registered to same adobe id with which you are trying to place the order?
    This offer is not available to Education, OEM, or volume licensing customers.
    You can send your CS4 license key to me in a private message if you want me to check its configuration.
    Here are the Terms and Conditions-
    Terms and Conditions | Adobe
    Thanks!
    Gurpreet

  • How do EDGE charges work/where do I look for itemized billing GoPhone Pic

    How do EDGE charges work/where do I look for itemized billing. I have the GoPhone Pick Your Plan. The AT&T _phone call_ charges are clearly itemized on line at AT&T.
    Can I view the charges for the Media Net Unlimited feature package? I have connected to WiFi at the local coffee shop. I have connected briefly to a local TV weather page while using EDGE. I fear the twenty or thirty dollar charges I have read about if I do any serious use of Safari while using EDGE.
    I have explored this on the following:
    http://www.lindenlan.net/2007/08/15/prepaid-vs-contract-att-gophone-or-nation-pl an/
    and
    http://www.tuaw.com/2007/09/24/prepaid-data-packages-and-the-iphone/
    and both suggest I will be thoroughly reamed unless I am on a WiFi hot spot.
    Every time I read the word "Unlimited" in my unlimited Media Net package there is the dreaded double asterisk "**" and the warning "additional per minute charges apply.
    I don't see a charge for my maiden foray onto the internet using EDGE to view the weather page at KKTV so where is it. Surly I cannot use EDGE without charges on this turkey plan. Or can I ?

    How exciting ! You have gone way beyond the call of duty for me. I appreciate it; thanks. I am so pleased with the iPhone but did not want to spend my life in coffee shops just to use it. Also I need the map function at work to help my customers and we have no WiFi there yet. But looks like I am ok at work on EDGE.
    Every other day I was oscillating between being extremely pleased with my purchase and then chastising myself for spending all the money on the service that I was sure would be inadequate. I don't call much and considering how fast things are changing I don't want to be locked into a two year contract though I understand Apple is locked into five years exclusively with AT&T.
    I hope good things come your way !
    Message was edited by: barkingmad

  • How to fix ipad disabled? it is looking for password, it looks like its frozen

    how to fix ipad disabled? it is looking for password, it looks like it's frozen.

    First, try a system reset.  It cures many ills and it's quick, easy and harmless...
    Hold down the on/off switch and the Home button simultaneously until you see the Apple logo.  Ignore the "Slide to power off" text if it appears.  You will not lose any apps, data, music, movies, settings, etc.
    If the Reset doesn't work, try a Restore.  Note that it's nowhere near as quick as a Reset.  It could take well over an hour!  Connect via cable to the computer that you use for sync.  From iTunes, select the iPad/iPod and then select the Summary tab.  Follow directions for Restore and be sure to say "yes" to the backup.  You will be warned that all data (apps, music, movies, etc.) will be erased but, as the Restore finishes, you will be asked if you wish the contents of the backup to be copied to the iPad/iPod.  Again, say "yes."
    At the end of the basic Restore, you will be asked if you wish to sync the iPad/iPod.  As before, say "yes."  Note that that sync selection will disappear and the Restore will end if you do not respond within a reasonable time.  If that happens, only the apps that are part of the IOS will appear on your device.  Corrective action is simple -  choose manual "Sync" from the bottom right of iTunes.
    If you're unable to do the Restore, go into Recovery Mode per the instructions here.

  • How can I write a program that compiles without warnings?

    I tried the following with the 1.5 beta-compiler (build 28; I think):
    class Y {
         public static final class Pair<X,Y> {
           private X fst;
           private Y snd;
           public Pair(X fst, Y snd) {this.fst=fst; this.snd=snd;}
           public X getFirst() { return fst; }
           public Y getSecond() { return snd; }
           public String toString() { return "("+fst+","+snd+")"; }
      public static void main(String... args) {
         Pair[] pairArr = new Pair[10];              // supposed to be an array of Pair<Integer,Integer>
         for (int i=0; i<pairArr.length; i++)
             pairArr[i] = new Pair<Integer,Integer>(i,i);
         for (int i=0; i<pairArr.length; i++) {
             Pair<Integer,Integer> p = pairArr; // unchecked warning
         System.out.println(p);
         Integer first = p.getFirst();
         Integer second = p.getSecond();
    // ... more stuff ...
    It turns out that I get an unchecked warning when I extract an element from the array of pairs. Okay, that's fine. How can I avoid the warning? I had expected that an explicit cast would help.
      Pair<Integer,Integer> p = (Pair<Integer,Integer> )pairArr;
    With a cast I'm telling the compiler: "I _know_ what I'm doing; please trust me." But the compiler still issues a warning.
    How can I write a warning-free program in this case? The only thing I can think of, is not using the parameterized type Pair in its parameterized form. But it's not the idea of Java Generics that I refrain from using parameterized types. What am I missing?

    It turns out that I get an unchecked warning when I
    extract an element from the array of pairs. Okay,
    that's fine. How can I avoid the warning? I had
    expected that an explicit cast would help.
    Pair<Integer,Integer> p = (Pair<Integer,Integer>
    )pairArr;
    With a cast I'm telling the compiler: "I _know_ what
    I'm doing; please trust me."  But the compiler still
    issues a warning.  Yes, but at least you were able to change the warning from "unchecked assignment" to "unchecked cast" which is a little shorter ;-)
    Seriously , since arrays of generic types are disallowed, there is probably no way to get rid of these warnings - which makes a strong point for eliminating "unchecked" warnings altogether (see the other thread "selectively suppressing compiler warnings")
    Cheerio,
    Gernot

  • How can I write a code that triggers when clicking on Save button

    I want to hide certain fields inside my tracking list, if the login user is not part of the “Managers” group.
    To do so I want to add the following Page-load code inside a web part :-
    using (SPSite site = new SPSite(SPContext.Current.Site.Url))
    using (SPWeb web = site.OpenWeb())
    {SPGroup group = site.Groups["Managers"];
    bool isUser = site.IsCurrentUserMemberOfGroup(group.ID);
    if (isUser)
    {textbox.Visible=false;}}
    And the following custom code that triggers when saving the form :-
    using (SPSite site = new SPSite(SPContext.Current.Site.Url))
    using (SPWeb web = site.OpenWeb())
    SPList list = web.Lists["ListName"];web.AllowUnsafeUpdates = true;
    SPListItem item = list.Items[SPContext.Current.ListItem.UniqueId];
    txtTitle.Text = item["Title"] as string;item.Update();web.AllowUnsafeUpdates = false;
    But I am not sure where exactly I should add the custom code for the save button ? I tried writing it inside the Oninit method , but I got many errors as shown below:-
    So can anyone advice how i should write the web part to include the Page load & the custom save button code?
    second question in general is my above approach considered valid , i mean to hide/show list columns using web parts ?

    Hi,
    According to your post, my understanding is that you want to hide/show list columns based on specify the permission for Users, SharePoint Groups or Active Directory Groups.
    Here is a solution from CodePlex for your reference:
    SharePoint 2013 Column & View Permission
    https://sp2013columnpermission.codeplex.com/
    Best Regards
    Dennis Guo
    TechNet Community Support

Maybe you are looking for