MACRO

Dear friends,

                    Presently i am doing a project. in that i had doubt, if i click the button it should insert the row and also should copy the formulas of previous row. for that i written below codings

Selection.EntireRow.Insert
    Range("E8:Z8").Select
    Selection.Copy
    Range("E11").Select
    ActiveSheet.Paste
    Application.CutCopyMode = True

      But my problem is this codings insert row after 'E11" only and always "E11". so please tell me how to insert row one after other i.e if i click the button it should first insert "E11' then "E12", "E13'' till atleast "E500"

Replies (5)

hi Deepan,

i am not able to understand clearly your requirement.....

the above code which you have written will always insert row in E11 , as you said.  And also it will always copy  the data which is in the range E8 to Z8...

I hope even the copy range should get altered every time when u insert a row...

The following code will help to insert a row and then copy the entire previous row data.....remember to place the cursor below the previous row data which you want to copy.....

For Eg: if Row 8 has, some data.  Place the cursor in Row 9 and run this macro.  So that one row will be inserted and Row 8 data will be copied into the inserted new row.

Hope this helps u. 

To copy entire previous row data......use the below code..

Sub copy( )
 
ActiveCell.EntireRow.Insert
ActiveCell.Offset(-1, 0).Range("A1").copy Destination:=ActiveCell.EntireRow
   
End Sub

To copy based on selected range....use this code....

This code will enable you to open a input box, where you can select the range and the same data will be copied down after inserting a row.  So you can select the range of previous row and the macro will insert a row and copy the same data.....

Sub copy2()
 
Dim rng As range

Set rng = Application.InputBox(Prompt:="Enter the Range (Previous row range)", Type:=8)

If rng Is Nothing Then

MsgBox "NO RANGE SELECTED"
Else
rng.Activate
End If

ActiveCell.Offset(1, 0).range("A1").Select

ActiveCell.EntireRow.Insert

rng.copy Destination:=ActiveCell

End Sub

Attaching the sample file...

 

Sir,

     Thank you sir and Sorry, because it is my mistake.  I like to explain my requirement with example. for that i have attached the file for your perusal

Thanking you,

Regards

Deepan Chakravarthy.E

hi Deepan,

Please check the attached file.

Hope it helps u

Regards,

guru

What are the custom rates for the import of software

Hey, Frndz finally i got to manage the details abt Macros..Even that i got in caclub only..Just thought of sharing in this form to help u..Thanks..Plz find it attached...

Leave a Reply

Your are not logged in . Please login to post replies

Click here to Login / Register  

Company
10 November 2026
FP&A Executive

Gujarat Guardian

Ankleshwar

CA Final

View Details
Company
25 November 2026
Finance Head

ILJIN ELECTRONICS

Bengaluru

CA

View Details
Company
13 November 2026
Accountant

New Mobile India

Muzaffarpur

B.Com

View Details
Company
Featured 17 November 2026
Chartered Accountant

M/s. A V C & Co.

New Delhi

CA

View Details
Company
19 November 2026
Accounts & Taxation Executive

MCSR and Associates LLP

Hyderabad

CA Inter

View Details
Company
14 November 2026
Manager - Indirect Tax (GST)

Westbridge Consulting LLP

New Delhi

CA

View Details
Company
28 October 2026
Assistant Director/ Associate Director-Finance & Accounting

Krea University

Chennai

CA

View Details
Company
20 November 2026
Charted Accountant

Cothas Coffee Co.

Bengaluru

CA

View Details