Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using macro to do same task with different cells


I m new to Excel VBA, i have a worksheet in which i want to select
cells in a coloumn and then paste in a row. Then i again want to copy
next cells and paste then in next row. I m trying to use DO UNTI
LOOP, and using following code

Sub copypaste1()
1 Dim k,i
2 For i = 1 To 1520
3 Do Until i = 1520
4 k = (i + 8) + (6 * (i - 1)) '' k=9,16,23,30
5 Range("B(k):B(k+6)").Select
6 Selection.Copy
7 Range("F(i+6)").Select
8 Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone
SkipBlanks:= _
False, Transpose:=True
9 Loop
10 Next
End Sub

but at line 5, "Method 'Range' of object '_Global' failed" erro
appeared. I think there is some problem in the way i am selecting th
cell range, any soln

--
abber0
-----------------------------------------------------------------------
abber05's Profile: http://www.excelforum.com/member.php...fo&userid=2756
View this thread: http://www.excelforum.com/showthread.php?threadid=47087

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using macro to do same task with different cells


Try this

Sub copypaste1()
Dim K as Integer, I as Integer
For i = 1 To 1520
Do
K = (I + 8) + (6 * (I - 1)) '' k=9,16,23,30
Range(Cells(K,2),Cells(K+6,2)).Select
Selection.Copy
Cells(I+6, 6).Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True
Loop Until i = 1520
Next
End Sub


--
Baapi
------------------------------------------------------------------------
Baapi's Profile: http://www.excelforum.com/member.php...o&userid=27333
View this thread: http://www.excelforum.com/showthread...hreadid=470871

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using macro to do same task with different cells


Little modification still required,
I have to remove DO UNTIL loop and then it starts working
anyhow, Thanks


--
abber05
------------------------------------------------------------------------
abber05's Profile: http://www.excelforum.com/member.php...o&userid=27564
View this thread: http://www.excelforum.com/showthread...hreadid=470871

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Event macro for a task TUNGANA KURMA RAJU Excel Discussion (Misc queries) 8 January 6th 06 10:43 AM
macro to automise the task TUNGANA KURMA RAJU Excel Discussion (Misc queries) 3 December 7th 05 07:42 PM
dialog box for active cell task to speed repeditive task Todd F.[_2_] Excel Programming 3 August 9th 05 02:30 PM
Repetitive task macro twaccess[_17_] Excel Programming 7 July 22nd 04 08:47 AM
Task Schedule for Macro mike0021[_3_] Excel Programming 3 May 25th 04 08:14 PM


All times are GMT +1. The time now is 03:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"