Home For loop through range, task is copy and paste special
Reply: 0

For loop through range, task is copy and paste special

user1786
1#
user1786 Published in July 21, 2018, 11:29 am

This is the issue related with for loop, I have searched the forums for the issue but couldn't find an answer related with the query. Spreadsheet has data like this

  A               B  C  D  E

2 20120425 09:55:00 101 99 102 100.50
3 20120425 09:55:00 101 102 98 101.50

What I want to do is like this on same sheet

  H       

2 101
3 99
4 102
5 100.50

That is copy range B2:E2 then select h2 and paste special( it will get paste on h2,h3,h4,h5.) Then repeat the task for B3:E3 copy the range and paste special on h6.

I have recorded the macro but task has to repeat on nearly 5000 rows I don't have a technical background and not that much familiar with VBA. I would appreciate any help possible for the problem.

History: I have tried few codes posted here which were familiar with the subject but most of the codes end up with run time error, few sucked the data and if i tried to edit something then VBA debugger would tell me that you can't run the code in break mode ( google for the error then pressed f5 to complete other running scripts and get some other sort of error like file has not been ended correctly or script error )

Recorded code

Sub Macro9()

' ' Macro9 Macro '

' Range("D1:G1").Select Selection.Copy Range("L1:L4").Select Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=True Range("D2:G2").Select Selection.Copy Range("L5:L8").Select Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=True End Sub

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.316855 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO