Thanks Ashish. Works like charm,
As always you all are a great help.

On Thursday, January 31, 2013 8:56:30 PM UTC+4, ashish wrote:

> *Try this code*
>
> Sub SJ()
>     Application.DisplayAlerts = False
>     Dim i As Long, j As Long
>     
>     On Error Resume Next
>     Sheets("Output").Delete
>     Sheets.Add(After:=Sheets(Sheets.Count)).Name = "Output"
>     On Error GoTo 0
>     For i = 2 To Sheets("before").Range("a65356").End(xlUp).Row
>         j = Sheets("Output").Range("a65356").End(xlUp).Row + 1
>         k = Sheets("before").Range("b" & i).Value
>         Sheets("before").Range("a" & i).Copy (Sheets("Output").Range("a" & 
> j & ":a" & j + k - 1))
>         Sheets("Output").Range("b" & j & ":b" & j + k - 1).Value = 1
>     Next
>     
>     
>     Sheets("Output").Columns("A:b").EntireColumn.AutoFit
>     
>     Application.DisplayAlerts = True
> End Sub
>
>
>
>
> On Thu, Jan 31, 2013 at 12:10 AM, Rashid Khan <prkh...@gmail.com<javascript:>
> > wrote:
>
>>  Hello All,
>> I am using Excel 2007.
>> The Sheet is attached.
>> I want the macro to insert blank rows as per the value in Col B and copy 
>> the data in the new Row putting the value of the inserted Rows in Col B.
>> I have highlighted the value both in Before and After (see below) so it 
>> is easy to understand my problem.
>>  
>> Following is my problem
>>  
>> *Before (Sheet1)*
>> ** 
>>      Col A                 Col B
>>     
>> *Code*
>>  
>> *Qty*
>>    
>> *3604272579928*
>>  
>> *5*
>>    
>> 3604272768711
>>  
>> 2
>>    
>> 3604272928818
>>  
>> 3
>>    
>> 3604273346260
>>  
>> 2
>>    
>> *After (Sheet2)*
>>  
>>    Col A                  Col B
>> ********    
>>
>> *Code*
>>  
>> *Qty*
>>    
>> *3604272579928*
>> ** ** ** 
>>
>> *1*
>> ** ** ** ** 
>>
>> *3604272579928*
>> ** ** ** 
>>
>> *1*
>> ** ** ** ** 
>>
>> *3604272579928*
>> ** ** ** 
>>
>> *1*
>> ** ** ** ** 
>>
>> *3604272579928*
>> ** ** ** 
>>
>> *1*
>> ** ** ** ** 
>>
>> *3604272579928*
>> ** ** ** 
>>
>> *1*
>>    
>> 3604272768711
>>  
>> 1
>>    
>> 3604272768711
>>  
>> 1
>>    
>> 3604272928818
>>  
>> 1
>>    
>> 3604272928818
>>  
>> 1
>>    
>> 3604272928818
>>  
>> 1
>>    
>> 3604273346260
>>  
>> 1
>>    
>> 3604273346260
>>  
>> 1
>>    
>> Any help would be appreciated.
>> Thanks in advance.
>> Rashid Khan
>>
>> -- 
>> Join official Facebook page of this forum @ 
>> https://www.facebook.com/discussexcel
>>  
>> FORUM RULES
>>  
>> 1) Use concise, accurate thread titles. Poor thread titles, like Please 
>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice 
>> will not get quick attention or may not be answered.
>> 2) Don't post a question in the thread of another member.
>> 3) Don't post questions regarding breaking or bypassing any security 
>> measure.
>> 4) Acknowledge the responses you receive, good or bad.
>> 5) Jobs posting is not allowed.
>> 6) Sharing copyrighted material and their links is not allowed.
>>  
>> NOTE : Don't ever post confidential data in a workbook. Forum owners and 
>> members are not responsible for any loss.
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "MS EXCEL AND VBA MACROS" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to excel-macros...@googlegroups.com <javascript:>.
>> To post to this group, send email to excel-...@googlegroups.com<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/excel-macros?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>
>
> -- 
> *Regards*
> * *
> *Ashish Koul*
>
>
>  *Visit*
> *My Excel Blog <http://www.excelvbamacros.com/>*
> Like Us on 
> Facebook<http://www.facebook.com/pages/Excel-VBA-Codes-Macros/151803898222297>
> Join Us on Facebook <http://www.facebook.com/groups/163491717053198/>
>
>
> P Before printing, think about the environment.
>  
>  
>

-- 
Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to