repetitive cut & paste by a macro

D

Don Guillett

As usual, please copy\paste your macro for comments and suggestions. Please
do NOT attach a file. Can you also copy/paste your url?
 
R

Rasoul Khoshravan Azar

I am copying a table with 12-columns x 140 rows from a web page to excel
(everyday)
Upon pasting, 10 columns appear in a row and remaining two columns shift to
beginning of next row. Now I get a table with 10 columns and 240 (2x140)
rows
I have to cut and paste these two cells manually.
I tried different ways to paste clearly in one raw but I couldn't so I think
I have to look for a sort of automizing method for cut and paste.

I am very novice with macro so I wrote a macro to do this. In start of
writing the macro, I choose two cells Range("A29:B29").Select
and continue but whenever I want to run this macro for a new row, it always
perform it on the same row ("A29:B29").
How can I automize this cut and paste procedure. Namely I have two distinct
issue
First: How can make a range variable in a macro
Second: I there any better approach other than wriiting a macro for sovling
above issue (returning two cells to end of previous row)

Thanks for your input in advance.
 
D

Dana DeLouis

Just an idea if it would work for you. In Excel XP, Go to <Data> <Import
External Data>, and then make a new web query. Hopefully, this works at
importing the data. Then I would have a macro work on this imported data.
 
R

Rasoul Khoshravan Azar

Thanks for your reply.
I didn't know about the "New WEb Query" command so it was very promising and
I tried it.

However it brings everyting in the page (offcourse I select to bring all
page in HTML format) except for figures which is of more importance for me.
Also from the web Page I can't find the name of table exactly as it
requires.

If you have any more comments, it is highly appreciated to reply. Or direct
me to a link where I can learn more about the New Web Query command.

TIA
Rasoul
 
R

Rasoul Khoshravan Azar

Dear Don
Thanks for your reply.
The simple macro is a follows:

Sub cutpaste()
'
' cutpaste Macro
' Macro recorded 2004/01/01 by Rasoul Khoshravan Azar
'

'
Range("A29:B29").Select
Selection.Cut
Range("K28").Select
ActiveSheet.Paste
End Sub

I couldn't copy the URL but the address is as follows:
http://www.parsportfolio.com/BazaarReports/DailyTrade/DailyTrade.asp
The content is in Farsi (National Language of Iran) which I am afraid could
not be meaningful for you but the table of figures is apparent.

TIA
Rasoul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top