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
ARTICLESHIP 15 September 2026
Freelance Taxation Content Writer Intern

Interactive Media Pvt Ltd.

New Delhi

CA Inter

View Details
Company
19 September 2026
Finance Manager

Mugdha Art Studio

Hyderabad

CA

View Details
Company
ARTICLESHIP 07 September 2026
Article/ Paid Assistant

Murali and Sumeet Chartered Accountant

Bengaluru

CA Foundation

View Details
Company
19 September 2026
CA/Semi-CA/BCom

Pravin Sarvaiya

Mumbai

CA Inter

View Details
Company
09 September 2026
Semi Qualified CA / CA Inter - 2 Groups Cleared

Getmyca Consultant Pvt Ltd

New Delhi

CA Inter

View Details
Company
ARTICLESHIP 16 September 2026
Article Assistant

MANUJ SHARMA AND COMPANY

Noida

CA Inter

View Details
Company
09 September 2026
Chartered Accountant

Aviv Global Private Limited

Ahmedabad

CA

View Details
Company
ARTICLESHIP 21 September 2026
CA Article Assistant

KK & Company Chartered Accountant

Pune

CA Inter

View Details