Macros-vb? c

Last Edited By Krjb Donovan
Last Updated: Mar 05, 2014 09:47 PM GMT

Question

Hi Damon, here's my situation: Ideally this involves two programs. C# & Excell. If you're not a c# guy, forget about the c# piece. Hopefully u can offer me macro/vb subsitutes for c#. So, everyday, i get a datafeed from c# source @ 09:28:28am I open Excell, insert a new fresh line row#3. I hand enter the c# originated data into cells on fresh row#3. I copy up the formulas from row#4 to new fresh row#3. Then i start sorting 18 columns, in sequence. Columns AZ:BQ The rows in this sort are fresh insert row#3 thru row#143. While sorting, i enter a "1" into any empty cell from row#3 to row68. Any cells with 1's below 68, i leave alone. I've tried to get it done by 09:29:29am, but i cant get it all done by hand in time.

Can you show me how to do it like,using a macro? Automatically? Is it possible to have Excell-03 learn to just stroke&sort itself out?

After all the key stroking and sorting, i need 1 more sort, where the most current date in B3 is up in Row#3 just under the 2 headers. It would be cool if i could run that all in 1 minute of time, or less.

Do you think c# might be able to process the keystrokes and sorts any faster than Excell could?


Answer

First, I apologize for my delayed response. I forgot to check my inbox when I returned from vacation and discovered just last night that I had 8 pending questions. Yikes!

I am not a C# person, but know that C# and VBA are very similar (virtually line-for-line) when it comes to statements that operate onobjects. I think that the steps you describe can be fairly easily coded in VBA, but you would then have to translate into C#. I believe such a macro should only take a second or two to execute, and doubt you would see a measurable difference in speed of VBA vs C# because there would not be very many VBA or C# statements being executed--the statements would be simply runningobject Methods (which are either coded in assembler or C) to do the sorts, etc.

I will be happy to provide you with some VBA code, but have a question. You mention entering the C#-originated data into cells on row 3. Are these data in C# variables? If so, it would help to know the variable names to give you code you can apply more directly.

Also, could you email me a before and after example of the spreadsheet along with the row 3 data so I can test the code I provide? My email is VBAexpert-AT-myway.com (replace -AT- with @).

Advertisement

©2017 eLuminary LLC. All rights reserved.