CAN AN EXCEL XLSM FILE READ FROM A CSV AND WRITE BACK TO THE SAME XLSM -VBA

Hey Carlos- Here's the repost. 
Could an XLSM file read a line from a CSV file in "A1" and depending on what was in the first column in the XLSM, search the CSV file and find the indexed item in the second column or third? I've done it before with standard VLookup functions and it was cumbersome and very slow, and for some reason, everytime I would save the file it would take forever although the xls file was a single sheet.
i've attacthed a sketch of what I'm talking about, because it's hard to explain and I think the sketch explains it better. Here it is, sorry if it is blurry, it looked fine before I posted:

ok, use this version, I changed it a bit. To accommodate the issue with the single cell, I moved the main procedures to a function for a more efficient use.
Sub xlsmCsvLookup()
    'have both your xlsm and your csv files open
    'in the xlsm file, select a range of cells to look up
    'run the script to search all selected cells and get the values from the csv file
    Dim csvDataRange As Range 'csv file data column
    Dim selRange As Range 'to hold selected cells
    Dim foundRange As Range
    'get the source range
    Set csvDataRange = Workbooks("Book2.csv").Sheets(1).Range("a:a") ' replace "Book2" with yourCSVfile.csv
    'check for selection, only one cell, ceck that cell and exit, otherwise loop thru selection
    If Selection.Count > 1 Then
        'loop thru all selected cells, ignore empty cells
        For Each selRange In Selection.SpecialCells(xlCellTypeConstants)
            findSelection selRange, csvDataRange
        Next
    Else
        findSelection ActiveCell, csvDataRange
    End If
    Set foundRange = Nothing
    Set selRange = Nothing
    Set csvDataRange = Nothing
End Sub
Function findSelection(selRange, csvDataRange)
        'try to find it in the csv file
        Set foundRange = csvDataRange.Find(selRange) 'if found, assign it to foundRange
        'if no match highligh cut
        If foundRange Is Nothing Then
            selRange.Interior.ColorIndex = 34
        Else
            'if found, get the value in next cell
            selRange.Offset(0, 1) = foundRange.Offset(0, 1)
        End If
End Function

Similar Messages

  • Can Anyone help with syncing my contacts are getting duplicated and there is a file from my computer and they are not the same it is driving me carazy can anyone help?

    Can Anyone help with syncing my contacts are getting duplicated and there is a file from my computer and they are not the same it is driving me carazy can anyone help?

    Are you in DSL? Do you know if your modem is bridged?
    "Sometimes your knight in shining armor is just a retard in tin foil.."-ARCHANGEL_06

  • Can I remove backuped files/folders from Azure Backup storage without un-registor the servers ?

    Can I remove backuped files/folders from Azure Backup storage without un-registor the servers ?
    I want to remove some backuped files/folders to compact Azure Backup Storage and to save the cost of Azure Backup.
    Scenario 1: remove tempolary files from Azure Backup Storage.
    Scenario 2: remove no-recovery files from Azure Backup Storage.
    Scenario 3: move the files from backup target folder to other storage's folder.
    Now, To remove backup files/folder from Azure Backup storage, I seems to need un-register the servers, and register the server.
    Regards,
    Yoshihiro Kawabata

    Thank you Giri, for quick reply.
    I want to save the Azure Backup storage cost, now.
    I don't want to pay the Azure Backup storage cost for no-restore-need files until the backup point gets aged.
    and I don't want to remove / re-backup the restore need files by un-register/register operation.
    I feedback this issue to feedback.azure.com.
    "Remove files/folders from Backup"
    http://feedback.azure.com/forums/258995-azure-backup-and-scdpm/suggestions/7421659-remove-files-folders-from-backup
    Regards,
    Yoshihiro Kawabata

  • How can i erase my .me mails from my iPhone and keep them in the server

    how can i erase my .me mails from my iPhone and keep them in the server

    You can't. The iPhone doesn't actually store all your emails anyway. It is showing you what is on the server directly.
    Only the most recently accessed emails are cached (stored temporarily) on your phone for access when you are offline. If you delete an email from your iPhone, you are actually deleting it from the server.

  • Can i add two country holiday on my iCal and see them at the same time?

    Can i add two country holiday on my iCal and see them at the same time? HOW?

    Just subscribe to the appropriate calendars: you can subscribe to as many as you like.
    http://www.apple.com/downloads/macosx/calendars/

  • Can I create a JAR that is an Applet and Desktop app at the same time?

    Hi mates.
    Can I create a JAR that is an Applet and Desktop app at the same time?
    Thanks.

    Ricardo_Ruiz_Lopez wrote:
    ..I have one problem, I want a JMenuBar but I can't add it inside a jPanel.
    Any idea?
    SSCCE
    It can be compiled/run as an applet or application something like this (e.g. for a Win command prompt).
    C:\Users\Andrew\Hybrid> javac Hybrid.java
    C:\Users\Andrew\Hybrid> java Hybrid
    C:\Users\Andrew\Hybrid> appletviewer Hybrid.java
    C:\Users\Andrew\Hybrid> // YES the previous line requires a '.java'  suffix - trust me.  ;-)Code
    // <applet code='Hybrid' width='600' height='400'></applet>
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    public class Hybrid extends JApplet {
        public void init() {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    GUI gui = new GUI();
                    getContentPane().add( gui.getMainPanel() );
                    setJMenuBar( gui.getMenuBar(false) );
                    validate();
        public static void main(String[] args) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    JFrame f = new JFrame("Test Hybrid");
                    f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
                    GUI gui = new GUI();
                    f.setContentPane(gui.getMainPanel());
                    f.setJMenuBar(gui.getMenuBar(true));
                    f.pack();
                    f.setLocationRelativeTo(null);
                    f.setVisible(true);
    class GUI {
        private JPanel mainGui = null;
        private JMenuBar menuBar = null;
        public JPanel getMainPanel(){
            if (mainGui==null) {
                mainGui = new JPanel( new BorderLayout(3,3) );
                mainGui.setBorder( new EmptyBorder(5,5,5,5) );
                JToolBar tb = new JToolBar();
                for (int ii=1; ii<6; ii++) {
                    tb.add( new JButton( "Btn " + ii) );
                    if (ii%2==0) {
                        tb.addSeparator();
                mainGui.add(tb, BorderLayout.NORTH);
                mainGui.add( new JSplitPane(
                    JSplitPane.HORIZONTAL_SPLIT,
                    new JScrollPane(new JTree()),
                    new JTextArea(20,20)
                    ), BorderLayout.CENTER );
                mainGui.add(new JLabel("Main user interface.."), BorderLayout.SOUTH);
            return mainGui;
        public JMenuBar getMenuBar(boolean isFloating) {
            if (menuBar == null) {
                menuBar = new JMenuBar();
                if (isFloating) {
                    JMenu fileMenu = new JMenu("File");
                    fileMenu.add( new JMenuItem("Exit") );
                    menuBar.add( fileMenu );
                JMenu helpMenu = new JMenu("Help");
                helpMenu.add( new JMenuItem("About") );
                helpMenu.add( new JMenuItem("Help") );
                menuBar.add( helpMenu );
            return menuBar;
    The code is not intended to be well designed. It is just written to be brief and demonstrate a few points.
    Edit 1:
    Added some access keywords in a passing gesture that the sample aimed at encapsulation.
    Edited by: AndrewThompson64 on Sep 2, 2010 1:34 PM

  • Imessage is buggy, i can login to it but does discontinues to verify and goes back to the login page,

    The problem with imessage with me and same thing too for my facetime, i can login but discontinues to verify and goes back to the login page. This is the second time where imessage is not working, the first time was "Unable to verify email" error, but i manage to solve it by just restarting my ipod. The second time, restart doesn't solve the issue, i wonder the iMessage app is pretty buggy, or servers are busy etc. I need help on this, does anyone has the same problem?

    Restore in iTunes. See
    http://support.apple.com/kb/HT4623

  • Read from Oracle DB and Write to MySQL

    Hi All,
    I am fairly new to database administration, so please bear with me if this is something that is simple or not achievable at all -
    SetUp:
    I have an Oracle DB on one dedicated Server, to which I only have a read_only access.
    I have a MySQL database setup on a windows server 2008, both are on the company network and accessible to internal employees only.
    Problem Statement:
    I need to read certain tables from Oracle DB and push the records to MySQL database.
    I have a stored procedure which was doing this but from one Oracle Schema to another, which is running fine, now I need to use the same stored procedure but read from one database (Oracle) and write to another database (MySQL), is there a way to do this through the stored procedure, I know I can write a java program to do this, but need to do it through a stored procedure.
    Appreciate any help in this regards.

    c5b4a91d-d35a-43ba-ac96-6d1821541d33 wrote:
    Hi All,
    I am fairly new to database administration, so please bear with me if this is something that is simple or not achievable at all -
    SetUp:
    I have an Oracle DB on one dedicated Server, to which I only have a read_only access.
    I have a MySQL database setup on a windows server 2008, both are on the company network and accessible to internal employees only.
    Problem Statement:
    I need to read certain tables from Oracle DB and push the records to MySQL database.
    I have a stored procedure which was doing this but from one Oracle Schema to another, which is running fine, now I need to use the same stored procedure but read from one database (Oracle) and write to another database (MySQL), is there a way to do this through the stored procedure, I know I can write a java program to do this, but need to do it through a stored procedure.
    Appreciate any help in this regards.
    Start here:  http://docs.oracle.com/cd/E11882_01/server.112/e25494/ds_concepts.htm#i1007709

  • How do I read from one table and write to another identical table?

    I am very new to Oracle. I am trying to do something that should be very simple.
    I am trying to read from one table in SQL and then write to another
    Identically formatted table. I keep getting various errors. Could someone please
    post some vey simple code that will work so that I can play around with it?
    Any help would be greatly appreciated.
    Thanks,
    Ron

    Thanks, but I must be missing something.
    I have two tables, SONGLIST and SETLIST.
    The second line by itself works just fine on either table.
    Here is the code I used following your seggestion, along with it's error message.
    Hope you can help. Thanks again...
    INSERT INTO SETLIST
    SELECT TITLE FROM SONGLIST WHERE ROTATION <> 'X'
    ORA-00947: not enough values

  • Can't copy large files anymore after downloading Mavericks, is anyone else having the same problems?

    I did drop my laptop a week ago but I tested everything and the USBs, CD Drive, and Pretty much everything else worked so I don't think it's that. Does anyone have the same problems or any advice for me? I have a Macbook Pro from August 2013

    This problem is often caused by "Google Drive." If it's installed, I suggest you first check for an update. If that doesn't solve the problem, remove it according to the developer's instructions. You may need to boot in safe mode to do so. Back up all data before making any changes.
    If you use Google Drive and don't want to remove it, then try deselecting the option in its preferences to "show status icons." According to reports, that may be enough to stop the Finder from crashing.

  • I have Windows 7, 64 bit, and I am using iTunes 11.0.1.12. I have been all through the threads and internet..how do I delete songs from my iTunes and hard drive at the same time? I have my music in the correct iTunes folder. Nothing works.

    Windows 7 64 bit
    iTunes 11.0.1.12
    I have my music in the correct iTunes folder
    In iTunes, I select songs, click "delete", then "move to recycle bin", finally, empty my recycle bin that shows the file is there
    File is still on my hard drive.
    I just want to be able to delete files out of my library and off of my hard drive at the same time. I have tried everything I have read, and there really seems to be no real answer. Somebody please help!

    Tarantulaman wrote:
    i do, but like i said it fell once and since then it hasn't been able to connect to my laptop. it acts like nothing's connected. i believe if i call the company the HDD is from they'll be able to transfer it to a new one but who knows how much they'd charge. looks like i have no choice now.
    If it were truly a backup, then the media would play on the laptop as it would be on the laptop.
    Sounds like you actually do not have a backup, instead you chose to keep your media on an external drive.
    Regardless of where the media is stored, it's always a good idea to have a backup for instances like this.

  • Selecting from one table and Update another in the same Page

    Could someone help me with this HTMLDB task. In my page design, I am selecting data from two tables (masters: DEPT, EMP) which I want to display on the left column of the page and at the same time a user would be able to update another table (ATTENDANCE:with many children) which would have a radiogroup on the right side for each value of the master such as employee name. The placement of data has to appear in corresponding rows on the page. For instance, employee names of the master table must appear on the same row with its corresponding child value. The page would be grouped by DEPT_NO. The user would click on the department name, a new page with the employee name would apprar. From that page, the user would then update attendance column for each employee in that department. In this operation, it is only the ATTENDANCE table that is being updated. I can send out more information about the structure of the tables if you need more information. I tried many HTMLDB options, forms, reports, etc. I have not been able to get quite right. Your help will be appreciated.

    Raju,
    Thanks for responding to my problem. I have actually tried using the example on how-to you sent me a link to but it did not help as I expected. You see, the page would be updated every meeting date for each employee. I can send you more information about the table structure if you like. However, let me see if this will help you a bit.
    Tables are: 1) Dept [dept_no (pk),dept_name] 2) EMP [emp_no (pk),emp_name, dept_no(fk)] 3) Meetings [meet_key(pk),attended, meeting_date, emp_no(fk)]
    What I want to do is create two pages, one would list the departments, when a user selects a department, the user would be linked to a meeting attandance page. The meeting attendance page would list department name once, Meeting date once, and then list employees in that department. At the right column of every employee would be a checkbox for meeting.attended for update. The meeting_date would be pre-populated so that what the user would do is just check Yes/NO. The second page is the one I'm having the most problem with.
    If I can do a fetch from dept, emp, and meetings and then do an update on the Meetings table on the same page, I think that might solve the problem. That was how I solved it in MS Access three years ago.
    Here is email address in case you want to contact me directly. [email protected]
    Thanks again for your help.

  • I have an Ipod Touch 4.I've ben able to sync my music but some tracks from the same CD are being displayed as though they are from separate albums and not part of the same one!

    Tracks from imported cds are appearing as though they are from separate albums.Particularly  if they are compilations.

    You can use iTunes to select the multiple tracks of the same album, and give them the same Album Name from the info window.
    If that does not solve your problem, be sure to check if your songs have different sorting albums. If so, change or delete the text in the sorted albums text field.

  • Acquiring data from daq-pad and saving video at the same time

    I am trying to record data from my daq-pad at 100 samples per second. At the same time I am using a usb interfaced camera to record a video feed. The idea is that when i begin recording data i also begin recording the video feed.
    The way I record the video  feed works fine in its own VI (I need it to record at 30fps and it does this just fine). But when I integrate it with the data record/capture VI the framing rate slows down to only 10 fps. I suspect this is because the VI  gets caught capturing the data from the daq-pad thus slowing down its ability to record the video feed. I was hoping you could give me some help with how to record the data at 100 samples per second and get the VI to capture 30 frames per second. Thanks in advance for anyone who helps out.
    I've attached the VI that has both the data capture and the video capture already integrated.
    Attachments:
    usa_swimming with video21.vi ‏892 KB

    Hi,
    I took a look at your code and the problem is that you have both the data acquistion and the image acquistion in the same loop.  Have you tried using parellel loops?  There is more information about this in the labview tutorials that are available online if you are unsure how to do that.  The problem is that you are doing a lot of things in that loop (acquiring data, doing some analysis, and writing to file), so you can't acquire images very fast because it depends on the speed of the loop iteration.  I hope this helps.
    Have a great day,
    GG

  • Streaming from Macbook Pro and using it at the same time?

    Haven't decided yet if I'm going to buy the Apple TV or not, and I still have a few questions in the back of my mind. The biggest one being if I am streaming a movie from my MacBook Pro, does it still function regularly as a laptop or do I have to stop using it during the duration of the stream? I like to be able to work and watch movies or TV at the same time, and this is going to be a big deciding factor if I get one or not. Can anyone help? Thanks!

    if I am streaming a movie from my MacBook Pro, does it still function regularly as a laptop
    It does indeed. In fact when you use it, you probably wont even notice your computer is streaming content to the Apple TV.

Maybe you are looking for

  • Need help with ORACLE ADMIN, NETWORKING CONCEPTS and SQL, ASAP!

    Hey everyone. Basically my major is going to be computer science, however I haven't started the course yet. However I got a job offering to the position as a SEO. A friend told me as long as I can answer the questions, the job will be no problem, I m

  • Weird behavior in Flash CS6

    Flash Professional CS6 Windows 7 64 bit These problems were not present yesterday but are today, I was told that a system admin may have fubarred me. Thanks, System Admin! So before I put in the request for a system restore, let's see if we can fix i

  • Need help with LikeFilter for querying the keyset instead of value

    Hi, I'm looking for help with the LikeFilter. I need to query the cache to get all entries with key starting with a particular string. I could see samples using LikeFilter for querying the values in the cache but not the keyset. Can someone help? E.g

  • Downloading from TSTC

    We've just upgraded to ECC6.0, and we also have the previous 4.7 box up and running. In order to see what new Tcodes are available in ECC 6.0, I wanted to download the complete list of Tcodes from both systems (SE16N -> TSTC ), and then do a lookup i

  • ITunes won't start up, but icon is showing?

    Hi, I have a problem. I had upgraded iTunes to 7.0.2.16. When I went to open iTunes, it wouldn't start. The icon is showing, but when clicked on, my computer just makes noise, and then falls silent. Does anyone have any ideas to why this is??