Challenging VBA macro

MarkSarto

New Member
Joined
Jun 22, 2011
Messages
3
Dear all, apart from the fact that i am totally new to VBA and Macros in Excle programming, I really need your help!
I am asking your help to solve a quite huge problem which, by far, I really do not know if it is solveable with a Macro.
From one spreadsheet like the one in figure Spread.jpg, after having completed the following transformations with a macro, i must obtain a .txt file.
First of all let me explain the transformations that i should do on the spreadsheet.
Referring to spread.jpg the macro should:
a) Delete the first row (the one with the names)
b) Delete columns C,D,E,H,I,O,P
c) Transform the date format of the first column from DD-MM-YYYY into MM/YYYY
d)Multiply the each value of columns K,L,M,N for 100
e)Transform (transponse) every single row in column, as to display in a format like the one shown in picure text.jpg
Each set of data must then exported to a .txt file and should be separated by a simple line like shown on the same text.jpg picture.
Do you think this might be possible with a macro?! And how to do it!?
I would appreciate any help and would be very grateful.
Thanks, Mark.

http://img11.imageshack.us/img11/3465/spreadkl.jpg

http://img851.imageshack.us/img851/6742/textf.jpg
 
Last edited:

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Mark welcome to the forum, there is a certain amount of your task you can do by recording a macro and then follow your steps, ie select the 1st row and delete then do the same for the columns, then format the first column etc and you will end up with the code you need to start with (and it can be adjusted to run smoother) then it is a case of looking at the othe steps.

So plan your method to record the first few steps and stop recording then you have the beginnings.

The code you would end up with to start with is as follows:

<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> mcrD()<br><SPAN style="color:#007F00">'Adjusted recorded macro to delete first row</SPAN><br>    Rows("1:1").Delete Shift:=xlUp<br><SPAN style="color:#007F00">'Deleting Columns, C,D,E,H,I,O,P</SPAN><br>    Range("C:C,D:D,E:E,H:H,I:I,O:O,P:P").Delete Shift:=xlToLeft<br><SPAN style="color:#007F00">'Change date format for Column A to MMMM YYYY</SPAN><br>Columns("A:A").NumberFormat = "mmmm/yyyy"<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>
 
Upvote 0
Mark once you have the few stages done as per my code, then if you can post a sample of what is left then the additional code to Transpose and save as text file can be created for you.
 
Upvote 0
Thanks Trevor, already started recording and executing, it works perfectly even though it differs from your code. I'll keep on posting if anything does not work, is that all right for you!?
Thank you, tony
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,827
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top