+ Reply to Thread
Results 1 to 6 of 6

insert rows/columns

  1. #1
    Registered User
    Join Date
    07-07-2009
    Location
    Karachi
    MS-Off Ver
    Excel 2007
    Posts
    26

    Post insert rows/columns

    Hi to all!

    I have 3000 rows in a sheet. I'm using following code to insert blank row becasue i need to create space between two rows.

    Sub InsRows()
    Dim LR As Long, i As Long, j As Integer
    LR = Cells(Rows.Count, "A").End(xlUp).Row
    For i = LR To 2 Step -1
    Rows(i).Insert
    Next i
    End Sub
    Now the problem is that i need also to insert a blank column between two columns.My columns are "A:AC".

    i need expert advice where i will add extra line of code that will do both work like insert row and also column.

    My english is not good. so i beg your pardon.
    regards
    Last edited by sheryar; 12-23-2009 at 12:10 PM.

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: insert rows/columns

    Per the Forum Rules you agreed to follow, please amend your thread to apply code tags. All VBA code must be wrapped in code tags.

    3. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # button at the top of the post window. If you are editing an existing post, press Go Advanced to see the # button. For more information about these and other tags, click here.
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    Registered User
    Join Date
    07-07-2009
    Location
    Karachi
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: insert rows/columns

    Hi!
    Thanks for your information. I'll be carefull in future

  4. #4
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: insert rows/columns

    Code amended, changes in red.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-07-2009
    Location
    Karachi
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: insert rows/columns

    Hi!
    Thanks for your help.I was making mistake instead using xltoleft i tried with xltoright.
    Thanks again my problem solved.
    regards

  6. #6
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: insert rows/columns

    Glad to have helped.

    Please be sure to mark your thread as solved by going to top of your first post anc clicking on Thread Tools, then Go Advanced.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1