Solved

Streamline Excel Macro procedure

Posted on 2011-03-11
6
214 Views
Last Modified: 2012-05-11
Hi All,
I am trying to create a macro so when formated the data can be sent directly to an access dba. I have managed to get most of it done with trial and error but not working like I want it too. Maybe someone can show me how to make it more efficient.
I have a spreedsheet that is generated by a third party software in .csv format. I then manually copy the data from that spreedsheet into another spreedsheet with macro to format the data for export to an Access database. Would probaly just ask another question with this part.

So basically I copy data from the .csv sheet onto sheet1 of the other database. I select ctrl-G to run the macro to format. It fines matching records from the Employees sheet and sums totals.

Problems:

1. I can't get the date to format correctly.  it needs to be formatted as mm/dd/yyyy
2. I can't figure out how to get it to just use the line needed instead of entering a range then having to delete all the other rows. After the macro runs, I have to delete lines all the way down to row 400. Thats because I don't know how format the macro to only use the rows needed. HELP!!!!!!!

Any assistance would be greatly appreciated.

Thanks  
SecureMessagePerUser--5-.csv
SecureMessageEditor-test.xlsm
0
Comment
Question by:KLMServices
  • 3
  • 3
6 Comments
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35108978
Here is the updated file. I created a temp sheet2 so that you can copy the data from there directly instead of csv for testing purpose.

Regarding your 2 problems, they have been taken care of.

I am unsure what you want to do after Copying the Columns Columns("E:I") so I have entered an "Exit Sub" so that you can see the progress till there.

I have streamlined your code to quite an extent.

Let me know if you have any problems.

Sid
SecureMessageEditor.xlsm
0
 

Author Comment

by:KLMServices
ID: 35109675
Thanks Sid,

Much better than what I had. But when the macro is ran, it should only have 5 columns of data. Just like I had before.

date
queue
Agent
Extension
Message count

The queue column will needs to always populate "Web" in that field for each record. Your procedure generates the correct information, but just need the information to populate in column A thru E.

Reason for this is, I will have to copy and paste this data directly into access, hopefully I would be able to automate this process also.

Hopefully I was able to explain myself.

Thanks again for your help with this.
0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35114038
The macro generates this In E-I (Total 5 Cols)

                        NumberOfMessages
06124061            Smith      8510993      15
06124061            Nelson      8518266      1
06124061            Storie      8519916      10
06124061            Story            1
06124061            Ross      8519995      2

How are they supposed to be incorporated in Col A-D (Total 4 Cols)?

Sid
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:KLMServices
ID: 35114521
If you run my original macro you will notice that it only leaves has the date, web, name, extension and calls in A - D. In the macro that you did, I am not sure what 06124061 represents.
0
 
LVL 30

Accepted Solution

by:
SiddharthRout earned 500 total points
ID: 35114741
Please test this for me.

Sid
SecureMessageEditor-test.xlsm
0
 

Author Closing Comment

by:KLMServices
ID: 35115757
This solution is perfect. You make it look so easy. Thanks for your help on this. Now I will tackle exporting formatted data to an Access dba
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question