Closed Thread
Results 1 to 7 of 7

Basic Macro needed

  1. #1
    Registered User
    Join Date
    11-02-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    4

    Basic Macro needed

    Hi all

    Have used these sorts of macro's before just by recording and then editing slightly but the one below just deletes the whole sheet.

    I have a lot of data copied from another application. I paste into sheet1.

    I need to delete column 1, columns V,W,X then Rows 1-5

    Then go to sheet 2 copy some field headers, paste back at top of data sheet1.

    Here is the code

    Sub Macro1()
    Columns("A:A").Select
    Selection.Delete Shift:=xlToLeft
    Range("V1").Select
    Columns("V:X").Select
    Selection.Delete Shift:=xlToLeft
    Rows("1:5").Select
    Selection.Delete Shift:=xlUp
    Sheets("Sheet2").Select
    Range("A1:AD1").Select
    Selection.Copy
    Sheets("Sheet1").Select
    Range("A1:AD1").Select
    ActiveSheet.Paste
    End Sub

    After the first column delete the whole sheet 1 seems to get selected then deleted instead of columns V-X?

    Any help appreciated, thanks

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Basic Macro needed

    basic reading of the Rules required

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    Your post does not comply with Rule 3 of our Forum RULES. 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 # at the top of your post window. For more information about these and other tags, found here
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    11-02-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Basic Macro needed

    Your rules SUCK

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Basic Macro needed

    Nobody forces you to come here for free advice from top Excel specialists, many acknowledged by Microsoft as MVPs.

    If you can't be bothered to comply with a few simple rules that make it easier for the members to answer your questions, then, actually, we can't be bothered to spend time on your issue.

    Have a nice day.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Basic Macro needed

    Nice work teylyn. Looking at his code he needs all the help that he can get!

  6. #6
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Basic Macro needed

    It's just a cool-off period for one month.

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Basic Macro needed

    Would have been life ban if I had done it

Closed 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